Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 265 additions & 17 deletions .gitignore

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions TextmagicRest.Examples/App.config

This file was deleted.

13 changes: 5 additions & 8 deletions TextmagicRest.Examples/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using TextmagicRest;
using TextmagicRest.Model;

namespace textmagicsample
namespace TextmagicRest.Examples
{
class Program
public class Program
{
public static void Main(string[] args)
public static void Main()
{
sendMessage();
SendMessage();

Console.WriteLine("Check your phone ;-)");
Console.WriteLine("Press any key to continue . . . ");
Console.ReadKey(true);
}

public static void sendMessage()
public static void SendMessage()
{
var client = new Client("replace-with-username", "replace-with-user-api-key");
var link = client.SendMessage("Hello from TextMagic API C# Wrapper demo application", "replace-with-phoneNumber-WithInternationalPrefix");
Expand Down
36 changes: 0 additions & 36 deletions TextmagicRest.Examples/Properties/AssemblyInfo.cs

This file was deleted.

67 changes: 7 additions & 60 deletions TextmagicRest.Examples/TextmagicRest.Examples.csproj
Original file line number Diff line number Diff line change
@@ -1,65 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2072E259-422B-4F76-A874-01A50079CF67}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TextmagicRest.Examples</RootNamespace>
<AssemblyName>TextmagicRest.Examples</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TextmagicRest\TextmagicRest.csproj">
<Project>{2aa7cf5d-8e4c-4c6d-8871-26afbe6c078f}</Project>
<Name>TextmagicRest</Name>
</ProjectReference>
<ProjectReference Include="..\TextmagicRest\TextmagicRest.csproj" />
</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>

</Project>
22 changes: 9 additions & 13 deletions TextmagicRest.Tests/Common.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using System.Net;
using System.Net;
using Moq;
using RestSharp.Deserializers;
using RestSharp;
using RestSharp.Serialization.Json;

namespace TextmagicRest.Tests
{
Expand All @@ -15,13 +10,14 @@ public static class Common
public static string Username = "csharp-test-username";
public static string Token = "csharp-test-token";

public static IRestClient CreateClient<T>(string json, ResponseStatus? responseStatus, HttpStatusCode? statusCode) where T: new()
public static IRestClient CreateClient<T>(string json, ResponseStatus? responseStatus,
HttpStatusCode? statusCode) where T : new()
{
var resp = new RestResponse<T>()
var resp = new RestResponse<T>
{
ContentType = "application/json",
ResponseStatus = responseStatus.HasValue? (ResponseStatus)responseStatus: RestSharp.ResponseStatus.Completed,
StatusCode = statusCode.HasValue? (HttpStatusCode)statusCode: HttpStatusCode.OK,
ResponseStatus = responseStatus.HasValue ? (ResponseStatus) responseStatus : ResponseStatus.Completed,
StatusCode = statusCode.HasValue ? (HttpStatusCode) statusCode : HttpStatusCode.OK,
Content = json
};

Expand All @@ -35,4 +31,4 @@ public static class Common
return mock.Object;
}
}
}
}
Loading