changeset 108:786a90e26c9b

Los tests ya twittean con la cuenta de altnet-hispano-desa
author Nelo@Kenia.neluz.int
date Tue, 07 Jun 2011 23:07:06 -0300
parents 1ee5711256db
children 6bd9be78caa0
files Agendas/trunk/src/Agendas.Twitter.Tests/Agendas.Twitter.Tests.csproj Agendas/trunk/src/Agendas.Twitter.Tests/App.config Agendas/trunk/src/Agendas.Twitter.Tests/Properties/AssemblyInfo.cs Agendas/trunk/src/Agendas.Twitter.Tests/Send_twitt_tests.cs Agendas/trunk/src/Agendas.Twitter.Tests/packages.config Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs Agendas/trunk/src/Agendas.sln Agendas/trunk/src/install packages.bat
diffstat 8 files changed, 210 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Agendas.Twitter.Tests.csproj	Tue Jun 07 23:07:06 2011 -0300
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{462D86DD-7F4D-4596-B18B-2DD92C7FD73F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Agendas.Twitter.Tests</RootNamespace>
+    <AssemblyName>Agendas.Twitter.Tests</AssemblyName>
+    <TargetFrameworkVersion>v4.0</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="Newtonsoft.Json">
+      <HintPath>..\packages\Newtonsoft.Json.3.5.8\lib\35\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.framework">
+      <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.mocks">
+      <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll</HintPath>
+    </Reference>
+    <Reference Include="pnunit.framework">
+      <HintPath>..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Twitterizer2">
+      <HintPath>..\packages\twitterizer.2.3.2\lib\Twitterizer2.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Send_twitt_tests.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Agendas.Domain\Agendas.Domain.csproj">
+      <Project>{A14907DF-02E4-4FA7-BE27-4292AF50AA22}</Project>
+      <Name>Agendas.Domain</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\Agendas.Twitter\Agendas.Twitter.csproj">
+      <Project>{D8DA7ED2-A274-4DF6-9DD2-A9DC65F4C2F5}</Project>
+      <Name>Agendas.Twitter</Name>
+    </ProjectReference>
+  </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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/App.config	Tue Jun 07 23:07:06 2011 -0300
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+	<appSettings>
+		<add key="consumerKey" value="UpwG7RKRAqQfdsCKnBfHA"/>
+		<add key="consumerSecret" value="HIOb9tMewejyFX97mhsQO2FXSEQN4kzJFF6iQLx4k"/>
+		<add key="accessToken" value="301500900-1GGyiecfAgmbrJMEcjp4XA9KXEJU2bBLyEQNQL5S" />
+		<add key="accessTokenSecret" value="46vNqg4djzyh9GRtZoUv0c7uEl7mQ3CjVBeJ4wwRpds"/>
+	</appSettings>
+</configuration>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Properties/AssemblyInfo.cs	Tue Jun 07 23:07:06 2011 -0300
@@ -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("Agendas.Twitter.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Agendas.Twitter.Tests")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[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("fb277dd8-af44-4be7-a300-70902bb2de61")]
+
+// 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")]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/Send_twitt_tests.cs	Tue Jun 07 23:07:06 2011 -0300
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using AltNetHispano.Agendas.Twitter;
+using NUnit.Framework;
+using Twitterizer;
+
+namespace Agendas.Twitter.Tests
+{
+	[TestFixture]
+	public class Send_twitt_tests
+	{
+		[Test]
+		public void Send_twitt()
+		{
+			var p = new TwitterPublicador();
+
+			string message;
+			var r = p.Publicar("Hello, #Twitterizer", out message);
+
+			Console.WriteLine(message);
+			Assert.IsTrue(r);
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Agendas/trunk/src/Agendas.Twitter.Tests/packages.config	Tue Jun 07 23:07:06 2011 -0300
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="NUnit" version="2.5.10.11092" />
+  <package id="Newtonsoft.Json" version="3.5.8" />
+  <package id="twitterizer" version="2.3.2" />
+</packages>
\ No newline at end of file
--- a/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs	Tue Jun 07 21:03:56 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs	Tue Jun 07 23:07:06 2011 -0300
@@ -1,14 +1,55 @@
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using AltNetHispano.Agendas.Domain;
+using Twitterizer;
 
 namespace AltNetHispano.Agendas.Twitter
 {
 	public class TwitterPublicador : IPublicador
 	{
+		private string ConsumerKey
+		{
+			get { return ConfigurationManager.AppSettings["consumerKey"]; }
+		}
+
+		private string ConsumerSecret
+		{
+			get { return ConfigurationManager.AppSettings["consumerSecret"]; }
+		}
+
+
+		private string AccessToken
+		{
+			get { return ConfigurationManager.AppSettings["accessToken"]; }
+		}
+
+
+		private string AccessTokenSecret
+		{
+			get { return ConfigurationManager.AppSettings["accessTokenSecret"]; }
+		}
+
 		public void Publicar(IEnumerable<Track> tracks)
 		{
 			throw new NotImplementedException();
 		}
+
+		public bool Publicar (string status, out string message)
+		{
+			var tokens = new OAuthTokens
+			             	{
+			             		ConsumerKey = ConsumerKey,
+			             		ConsumerSecret = ConsumerSecret,
+			             		AccessToken = AccessToken,
+			             		AccessTokenSecret = AccessTokenSecret
+			             	};
+
+			var response = TwitterStatus.Update(tokens, status);
+
+			message = response.ErrorMessage;
+			return response.Result == RequestResult.Success;
+
+		}
 	}
 }
\ No newline at end of file
--- a/Agendas/trunk/src/Agendas.sln	Tue Jun 07 21:03:56 2011 -0300
+++ b/Agendas/trunk/src/Agendas.sln	Tue Jun 07 23:07:06 2011 -0300
@@ -30,6 +30,8 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Resources", "Agendas.Resources\Agendas.Resources.csproj", "{444D25FB-FC1C-48DC-9EAD-D4C78F2A10CA}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agendas.Twitter.Tests", "Agendas.Twitter.Tests\Agendas.Twitter.Tests.csproj", "{462D86DD-7F4D-4596-B18B-2DD92C7FD73F}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -80,6 +82,10 @@
 		{444D25FB-FC1C-48DC-9EAD-D4C78F2A10CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{444D25FB-FC1C-48DC-9EAD-D4C78F2A10CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{444D25FB-FC1C-48DC-9EAD-D4C78F2A10CA}.Release|Any CPU.Build.0 = Release|Any CPU
+		{462D86DD-7F4D-4596-B18B-2DD92C7FD73F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{462D86DD-7F4D-4596-B18B-2DD92C7FD73F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{462D86DD-7F4D-4596-B18B-2DD92C7FD73F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{462D86DD-7F4D-4596-B18B-2DD92C7FD73F}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
--- a/Agendas/trunk/src/install packages.bat	Tue Jun 07 21:03:56 2011 -0300
+++ b/Agendas/trunk/src/install packages.bat	Tue Jun 07 23:07:06 2011 -0300
@@ -3,5 +3,6 @@
 ..\tools\nuget i Agendas.NHibernate\packages.config -o packages
 ..\tools\nuget i Agendas.Web\packages.config -o packages
 ..\tools\nuget i Agendas.Twitter\packages.config -o packages
+..\tools\nuget i Agendas.Twitter.Tests\packages.config -o packages
 
 PAUSE
\ No newline at end of file