Skip to content

Commit d04276d

Browse files
authored
Merge pull request #197 from darrencauthon/more-clean-up-for-2
Update tests and examples
2 parents 58af0be + 3fb0fa6 commit d04276d

File tree

165 files changed

+1879
-1824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+1879
-1824
lines changed

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"csharpier": {
6+
"version": "0.18.0",
7+
"commands": [
8+
"dotnet-csharpier"
9+
]
10+
}
11+
}
12+
}

.csharpierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"printWidth": 150,
3+
"preprocessorSymbolSets": ["", "DEBUG", "DEBUG,CODE_STYLE"]
4+
}

.editorconfig

Lines changed: 555 additions & 0 deletions
Large diffs are not rendered by default.

examples/BCC/BCC.csproj

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProjectGuid>{16978032-B34C-44B6-8DA1-475D751338F1}</ProjectGuid>
3+
<TargetFramework>net6.0</TargetFramework>
74
<OutputType>Exe</OutputType>
8-
<RootNamespace>BCC</RootNamespace>
9-
<AssemblyName>BCC</AssemblyName>
10-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
115
</PropertyGroup>
12-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
13-
<DebugSymbols>true</DebugSymbols>
14-
<DebugType>full</DebugType>
15-
<Optimize>false</Optimize>
16-
<OutputPath>bin\Debug</OutputPath>
17-
<DefineConstants>DEBUG;</DefineConstants>
18-
<ErrorReport>prompt</ErrorReport>
19-
<WarningLevel>4</WarningLevel>
20-
<Externalconsole>true</Externalconsole>
21-
</PropertyGroup>
22-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23-
<DebugType>full</DebugType>
24-
<Optimize>true</Optimize>
25-
<OutputPath>bin\Release</OutputPath>
26-
<ErrorReport>prompt</ErrorReport>
27-
<WarningLevel>4</WarningLevel>
28-
<Externalconsole>true</Externalconsole>
29-
</PropertyGroup>
30-
<ItemGroup>
31-
<Reference Include="System" />
32-
<Reference Include="System.Configuration" />
33-
<Reference Include="Newtonsoft.Json">
34-
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
35-
</Reference>
36-
<Reference Include="SparkPost">
37-
<HintPath>..\packages\SparkPost.1.6.2\lib\net45\SparkPost.dll</HintPath>
38-
</Reference>
39-
</ItemGroup>
40-
<ItemGroup>
41-
<Compile Include="Program.cs" />
42-
<Compile Include="Properties\AssemblyInfo.cs" />
43-
</ItemGroup>
44-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
456
<ItemGroup>
46-
<None Include="packages.config" />
7+
<ProjectReference Include="..\..\src\SparkPost\SparkPost.csproj" />
478
</ItemGroup>
48-
</Project>
9+
</Project>

examples/BCC/Program.cs

Lines changed: 35 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,38 @@
11
using System;
2-
using System.Configuration;
2+
using SparkPost;
33

4-
namespace SparkPost.Examples
4+
var apikey = "YOUR_API_KEY";
5+
var fromAddr = "from-csharp@yourdomain.com";
6+
var toAddr = "to@you.com";
7+
var ccAddr = "cc@them.com";
8+
var bccAddr = "bcc@sneaky.com";
9+
10+
var trans = new Transmission();
11+
12+
var to = new Recipient { Address = new Address { Email = toAddr } };
13+
trans.Recipients.Add(to);
14+
15+
var cc = new Recipient
16+
{
17+
Address = new Address { Email = ccAddr, HeaderTo = toAddr }
18+
};
19+
trans.Recipients.Add(cc);
20+
21+
var bcc = new Recipient
522
{
6-
internal class BCC
7-
{
8-
public static void Main(string[] args)
9-
{
10-
var settings = ConfigurationManager.AppSettings;
11-
var fromAddr = settings["fromaddr"];
12-
var toAddr = settings["toaddr"];
13-
var ccAddr = settings["ccaddr"];
14-
var bccAddr = settings["bccaddr"];
15-
16-
var trans = new Transmission();
17-
18-
var to = new Recipient
19-
{
20-
Address = new Address {Email = toAddr}
21-
};
22-
trans.Recipients.Add(to);
23-
24-
var cc = new Recipient
25-
{
26-
Address = new Address
27-
{
28-
Email = ccAddr,
29-
HeaderTo = toAddr
30-
}
31-
};
32-
trans.Recipients.Add(cc);
33-
34-
var bcc = new Recipient
35-
{
36-
Address = new Address
37-
{
38-
Email = bccAddr,
39-
HeaderTo = toAddr
40-
}
41-
};
42-
trans.Recipients.Add(bcc);
43-
44-
trans.Content.From.Email = fromAddr;
45-
trans.Content.Subject = "SparkPost BCC / CC example";
46-
trans.Content.Text =
47-
"This message was sent To 1 recipient, 1 recipient was CC'd and 1 sneaky recipient was BCC'd.";
48-
trans.Content.Headers.Add("CC", ccAddr);
49-
50-
Console.Write("Sending BCC / CC sample mail...");
51-
52-
var client = new Client(settings["apikey"]);
53-
client.CustomSettings.SendingMode = SendingModes.Sync;
54-
55-
var response = client.Transmissions.Send(trans);
56-
57-
Console.WriteLine("done");
58-
}
59-
}
60-
}
23+
Address = new Address { Email = bccAddr, HeaderTo = toAddr }
24+
};
25+
trans.Recipients.Add(bcc);
26+
27+
trans.Content.From.Email = fromAddr;
28+
trans.Content.Subject = "SparkPost BCC / CC example";
29+
trans.Content.Text = "This message was sent To 1 recipient, 1 recipient was CC'd and 1 sneaky recipient was BCC'd.";
30+
trans.Content.Headers.Add("CC", ccAddr);
31+
32+
Console.Write("Sending BCC / CC sample mail...");
33+
34+
var client = new Client(apikey);
35+
36+
var response = await client.Transmissions.Send(trans);
37+
38+
Console.WriteLine("done");

examples/BCC/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

examples/BCC/packages.config

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/CC/CC.csproj

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProjectGuid>{2B086611-A56B-4857-9F7F-A8603D7AA3FD}</ProjectGuid>
3+
<TargetFramework>net6.0</TargetFramework>
74
<OutputType>Exe</OutputType>
8-
<RootNamespace>CC</RootNamespace>
9-
<AssemblyName>CC</AssemblyName>
10-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
115
</PropertyGroup>
12-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
13-
<DebugSymbols>true</DebugSymbols>
14-
<DebugType>full</DebugType>
15-
<Optimize>false</Optimize>
16-
<OutputPath>bin\Debug</OutputPath>
17-
<DefineConstants>DEBUG;</DefineConstants>
18-
<ErrorReport>prompt</ErrorReport>
19-
<WarningLevel>4</WarningLevel>
20-
<Externalconsole>true</Externalconsole>
21-
</PropertyGroup>
22-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23-
<DebugType>full</DebugType>
24-
<Optimize>true</Optimize>
25-
<OutputPath>bin\Release</OutputPath>
26-
<ErrorReport>prompt</ErrorReport>
27-
<WarningLevel>4</WarningLevel>
28-
<Externalconsole>true</Externalconsole>
29-
</PropertyGroup>
30-
<ItemGroup>
31-
<Reference Include="System" />
32-
<Reference Include="System.Configuration" />
33-
<Reference Include="Newtonsoft.Json">
34-
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
35-
</Reference>
36-
<Reference Include="SparkPost">
37-
<HintPath>..\packages\SparkPost.1.6.2\lib\net45\SparkPost.dll</HintPath>
38-
</Reference>
39-
</ItemGroup>
40-
<ItemGroup>
41-
<Compile Include="Program.cs" />
42-
<Compile Include="Properties\AssemblyInfo.cs" />
43-
</ItemGroup>
44-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
456
<ItemGroup>
46-
<None Include="..\app.config">
47-
<Link>app.config</Link>
48-
</None>
49-
<None Include="packages.config" />
7+
<ProjectReference Include="..\..\src\SparkPost\SparkPost.csproj" />
508
</ItemGroup>
51-
</Project>
9+
</Project>

examples/CC/Program.cs

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,31 @@
11
using System;
2-
using System.Configuration;
2+
using SparkPost;
33

4-
namespace SparkPost.Examples
4+
var apikey = "YOUR_API_KEY";
5+
var fromAddr = "from-csharp@yourdomain.com";
6+
var toAddr = "to@you.com";
7+
var ccAddr = "cc@them.com";
8+
9+
var trans = new Transmission();
10+
11+
var to = new Recipient { Address = new Address { Email = toAddr } };
12+
trans.Recipients.Add(to);
13+
14+
var cc = new Recipient
515
{
6-
internal class CC
7-
{
8-
public static void Main(string[] args)
9-
{
10-
var settings = ConfigurationManager.AppSettings;
11-
var fromAddr = settings["fromaddr"];
12-
var toAddr = settings["toaddr"];
13-
var ccAddr = settings["ccaddr"];
14-
15-
var trans = new Transmission();
16-
17-
var to = new Recipient
18-
{
19-
Address = new Address {Email = toAddr}
20-
};
21-
trans.Recipients.Add(to);
22-
23-
var cc = new Recipient
24-
{
25-
Address = new Address
26-
{
27-
Email = ccAddr,
28-
HeaderTo = toAddr
29-
}
30-
};
31-
trans.Recipients.Add(cc);
32-
33-
trans.Content.From.Email = fromAddr;
34-
trans.Content.Subject = "SparkPost CC example";
35-
trans.Content.Text = "This message was sent To 1 recipient and 1 recipient was CC'd.";
36-
trans.Content.Headers.Add("CC", ccAddr);
37-
38-
Console.Write("Sending CC sample mail...");
39-
40-
var client = new Client(settings["apikey"]);
41-
client.CustomSettings.SendingMode = SendingModes.Sync;
42-
43-
var response = client.Transmissions.Send(trans);
44-
45-
Console.WriteLine("done");
46-
}
47-
}
48-
}
16+
Address = new Address { Email = ccAddr, HeaderTo = toAddr }
17+
};
18+
trans.Recipients.Add(cc);
19+
20+
trans.Content.From.Email = fromAddr;
21+
trans.Content.Subject = "SparkPost CC example";
22+
trans.Content.Text = "This message was sent To 1 recipient and 1 recipient was CC'd.";
23+
trans.Content.Headers.Add("CC", ccAddr);
24+
25+
Console.Write("Sending CC sample mail...");
26+
27+
var client = new Client(apikey);
28+
29+
var response = await client.Transmissions.Send(trans);
30+
31+
Console.WriteLine("done");

examples/CC/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)