Permalink
Browse files

rearrnaged for running in visual c#

  • Loading branch information...
1 parent 137ac1c commit 5aea2a6ae5a0fc7b94cef2da76e818851aab5f38 @chad chad committed with Feb 2, 2010
Showing with 179 additions and 1 deletion.
  1. +7 −1 RedisSharp.sln
  2. +36 −0 RedisTest/Properties/AssemblyInfo.cs
  3. +63 −0 RedisTest/RedisTest.csproj
  4. +73 −0 RedisTest/test.cs
View
@@ -1,8 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+# Visual C# Express 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisSharp", "RedisSharp.csproj", "{165E0505-F29B-4ED4-A004-DD6472D4D430}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedisTest", "RedisTest\RedisTest.csproj", "{04B4656A-705E-4175-B768-FFEFDF2A075F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -13,6 +15,10 @@ Global
{165E0505-F29B-4ED4-A004-DD6472D4D430}.Debug|Any CPU.Build.0 = Debug|Any CPU
{165E0505-F29B-4ED4-A004-DD6472D4D430}.Release|Any CPU.ActiveCfg = Release|Any CPU
{165E0505-F29B-4ED4-A004-DD6472D4D430}.Release|Any CPU.Build.0 = Release|Any CPU
+ {04B4656A-705E-4175-B768-FFEFDF2A075F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {04B4656A-705E-4175-B768-FFEFDF2A075F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {04B4656A-705E-4175-B768-FFEFDF2A075F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {04B4656A-705E-4175-B768-FFEFDF2A075F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -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("RedisTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("RedisTest")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[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("e7313840-f768-43c6-b332-c790983b1abf")]
+
+// 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")]
View
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{04B4656A-705E-4175-B768-FFEFDF2A075F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RedisTest</RootNamespace>
+ <AssemblyName>RedisTest</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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>
+ </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>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="RedisSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\bin\Release\RedisSharp.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="test.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
@@ -0,0 +1,73 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+
+class Test {
+ static void Main (string[] args)
+ {
+ Redis r;
+ if (args.Length >= 2)
+ {
+ r = new Redis(args[0], Convert.ToInt16(args[1]));
+ } else {
+ r = new Redis();
+ }
+
+ r.Set ("foo", "bar");
+ if (r.Keys.Length < 1)
+ Console.WriteLine ("error: there should be at least one key");
+ if (r.GetKeys ("f*").Length < 1)
+ Console.WriteLine ("error: there should be at least one key");
+
+ if (r.TypeOf ("foo") != Redis.KeyType.String)
+ Console.WriteLine ("error: type is not string");
+ r.Set ("bar", "foo");
+
+ var arr = r.GetKeys ("foo", "bar");
+ if (arr.Length != 2)
+ Console.WriteLine ("error, expected 2 values");
+ if (arr [0].Length != 3)
+ Console.WriteLine ("error, expected foo to be 3");
+ if (arr [1].Length != 3)
+ Console.WriteLine ("error, expected bar to be 3");
+
+ r ["one"] = "world";
+ if (r.GetSet ("one", "newvalue") != "world")
+ Console.WriteLine ("error: Getset failed");
+ if (!r.Rename ("one", "two"))
+ Console.WriteLine ("error: failed to rename");
+ if (r.Rename ("one", "one"))
+ Console.WriteLine ("error: should have sent an error on rename");
+ r.Db = 10;
+ r.Set ("foo", "diez");
+ if (r.GetString ("foo") != "diez"){
+ Console.WriteLine ("error: got {0}", r.GetString ("foo"));
+ }
+ if (!r.Remove ("foo"))
+ Console.WriteLine ("error: Could not remove foo");
+ r.Db = 0;
+ if (r.GetString ("foo") != "bar")
+ Console.WriteLine ("error, foo was not bar");
+ if (!r.ContainsKey ("foo"))
+ Console.WriteLine ("error, there is no foo");
+ if (r.Remove ("foo", "bar") != 2)
+ Console.WriteLine ("error: did not remove two keys");
+ if (r.ContainsKey ("foo"))
+ Console.WriteLine ("error, foo should be gone.");
+ r.Save ();
+ r.BackgroundSave ();
+ Console.WriteLine ("Last save: {0}", r.LastSave);
+ //r.Shutdown ();
+
+ var info = r.GetInfo ();
+ foreach (var k in info.Keys){
+ Console.WriteLine ("{0} -> {1}", k, info [k]);
+ }
+
+ var dict = new Dictionary<string, byte[]>();
+ dict ["hello"] = Encoding.UTF8.GetBytes ("world");
+ dict ["goodbye"] = Encoding.UTF8.GetBytes ("my dear");
+
+ //r.Set (dict);
+ }
+}

0 comments on commit 5aea2a6

Please sign in to comment.