Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/SparkPost.Acceptance/MessageEventsSteps.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using TechTalk.SpecFlow;

namespace SparkPost.Acceptance
Expand All @@ -13,6 +14,7 @@ public MessageEventsSteps(ScenarioContext scenarioContext)
_scenarioContext = scenarioContext;
}

[Obsolete()]
[When(@"I ask for samples of '(.*)'")]
public async Task WhenIAskForSamplesOf(string events)
{
Expand Down
28 changes: 12 additions & 16 deletions src/SparkPost.Acceptance/SparkPost.Acceptance.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>SparkPost.Acceptance</AssemblyName>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Should" Version="1.1.20" />
<PackageReference Include="SpecFlow" Version="3.1.89" />
<PackageReference Include="SpecFlow.NUnit" Version="3.1.89" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.1.89" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.9.74" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.74" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<ProjectReference Include="..\SparkPost\SparkPost.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
<Content Include="testtextfile.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
19 changes: 10 additions & 9 deletions src/SparkPost.Acceptance/TransmissionsSteps.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using System;
using TechTalk.SpecFlow;

namespace SparkPost.Acceptance
{
[Obsolete]
[Binding]
public class TransmissionsSteps
{
Expand All @@ -11,49 +12,49 @@ public void GivenIHaveANewTransmission()
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission is meant to be sent from '(.*)'")]
public void GivenTheTransmissionIsMeantToBeSentFrom(string p0)
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission is meant to be sent to '(.*)'")]
public void GivenTheTransmissionIsMeantToBeSentTo(string p0)
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission content is")]
public void GivenTheTransmissionContentIs(Table table)
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission has a text file attachment")]
public void GivenTheTransmissionHasATextFileAttachment()
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission template id is set to '(.*)'")]
public void GivenTheTransmissionTemplateIdIsSetTo(string p0)
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission is meant to be CCd to '(.*)'")]
public void GivenTheTransmissionIsMeantToBeCCdTo(string p0)
{
ScenarioContext.Current.Pending();
}

[Given(@"the transmission is meant to be BCCd to '(.*)'")]
public void GivenTheTransmissionIsMeantToBeBCCdTo(string p0)
{
ScenarioContext.Current.Pending();
}

[When(@"I send the transmission")]
public void WhenISendTheTransmission()
{
Expand Down
2 changes: 1 addition & 1 deletion src/SparkPost.Tests/ClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Http;
using Xunit;

Expand Down
58 changes: 58 additions & 0 deletions src/SparkPost.Tests/EventsQueryTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Xunit;

namespace SparkPost.Tests
{
public class EventsQueryTests
{
public class Defaults
{
[Fact]
public void It_should_have_a_default_build_list()
{
Assert.NotNull(new EventsQuery().BounceClasses);
}

[Fact]
public void It_should_have_a_default_campaigns_list()
{
Assert.NotNull(new EventsQuery().Campaigns);
}

[Fact]
public void It_should_have_a_default_from_addresses_list()
{
Assert.NotNull(new EventsQuery().FromAddresses);
}

[Fact]
public void It_should_have_a_default_messages_list()
{
Assert.NotNull(new EventsQuery().Messages);
}

[Fact]
public void It_should_have_a_recipients_list()
{
Assert.NotNull(new EventsQuery().Recipients);
}

[Fact]
public void It_should_have_a_Subaccounts_list()
{
Assert.NotNull(new EventsQuery().Subaccounts);
}

[Fact]
public void It_should_have_templates_list()
{
Assert.NotNull(new EventsQuery().Templates);
}

[Fact]
public void It_should_have_transmissions_list()
{
Assert.NotNull(new EventsQuery().Transmissions);
}
}
}
}
24 changes: 24 additions & 0 deletions src/SparkPost.Tests/ListEventsResponseTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Xunit;

namespace SparkPost.Tests
{
public class ListEventsResponseTests
{
public class DefaultTests
{
[Fact]
public void It_should_not_have_nil_links()
{
var response = new ListEventsResponse();
Assert.NotNull(response.Link);
}

[Fact]
public void It_should_not_have_nil_events()
{
var response = new ListEventsResponse();
Assert.NotNull(response.Events);
}
}
}
}
4 changes: 3 additions & 1 deletion src/SparkPost.Tests/ListMessageEventsResponseTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Xunit;
using System;
using Xunit;

namespace SparkPost.Tests
{
[Obsolete]
public class ListMessageEventsResponseTests
{
public class DefaultTests
Expand Down
4 changes: 3 additions & 1 deletion src/SparkPost.Tests/MessageEventsQueryTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Xunit;
using System;
using Xunit;

namespace SparkPost.Tests
{
[Obsolete]
public class MessageEventsQueryTests
{
public class Defaults
Expand Down
27 changes: 9 additions & 18 deletions src/SparkPost.Tests/SparkPost.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<ApplicationIcon />
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>SparkPost.Tests</AssemblyName>
<OutputType>Library</OutputType>
<StartupObject />
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AutoMoq" Version="2.0.0" />
<PackageReference Include="CastAs" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Should" Version="1.1.20" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 10 additions & 10 deletions src/SparkPost.Tests/SuppressionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
Expand Down Expand Up @@ -35,14 +35,14 @@ public DeleteTests()
email = Guid.NewGuid().ToString();
}

[Test]
[Fact]
public async Task It_should_return_true_if_the_web_request_returns_no_content()
{
var result = await suppressions.Delete(email);
Assert.True(result);
}

[Test]
[Fact]
public async Task It_should_return_false_if_the_web_request_returns_anything_but_no_content()
{
response.StatusCode = HttpStatusCode.Accepted;
Expand All @@ -58,7 +58,7 @@ public async Task It_should_return_false_if_the_web_request_returns_anything_but
Assert.False(deleted);
}

[Test]
[Fact]
public async Task It_should_build_the_web_request_parameters_correctly()
{
var version = Guid.NewGuid().ToString();
Expand All @@ -79,7 +79,7 @@ public async Task It_should_build_the_web_request_parameters_correctly()
await suppressions.Delete(email);
}

[Test]
[Fact]
public async Task It_should_encode_the_email_address()
{
var version = Guid.NewGuid().ToString();
Expand Down Expand Up @@ -127,30 +127,30 @@ public CreateOrUpdateTests()
suppressions = new Suppressions(client.Object, requestSender.Object, dataMapper.Object);
}

[Test]
[Fact]
public async Task It_should_return_a_response_when_the_web_request_is_ok()
{
var result = await suppressions.CreateOrUpdate(suppressionsList);
Assert.NotNull(result);
}

[Test]
[Fact]
public async Task It_should_return_the_reason_phrase()
{
response.ReasonPhrase = Guid.NewGuid().ToString();
var result = await suppressions.CreateOrUpdate(suppressionsList);
Assert.Equal(response.ReasonPhrase, result.ReasonPhrase);
}

[Test]
[Fact]
public async Task It_should_return_the_content()
{
response.Content = Guid.NewGuid().ToString();
var result = await suppressions.CreateOrUpdate(suppressionsList);
Assert.Equal(response.Content, result.Content);
}

[Test]
[Fact]
public async Task It_should_make_a_properly_formed_request()
{
client.Setup(x => x.Version).Returns(Guid.NewGuid().ToString());
Expand All @@ -168,7 +168,7 @@ public async Task It_should_make_a_properly_formed_request()
await suppressions.CreateOrUpdate(suppressionsList);
}

[Test]
[Fact]
public async Task It_should_throw_if_the_http_status_code_is_not_ok()
{
response.StatusCode = HttpStatusCode.Accepted;
Expand Down
9 changes: 8 additions & 1 deletion src/SparkPost/BounceClass.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace SparkPost
namespace SparkPost
{
// The list was taken from:
// https://support.sparkpost.com/customer/portal/articles/1929896
Expand Down Expand Up @@ -66,6 +66,13 @@ public enum BounceClass
/// </summary>
AdminFailure = 25,

/// <summary>
/// Smart Send Suppression
/// The message was suppressed by Smart Send policy.
/// Category: Admin.
/// </summary>
SmartSendSuppression = 26,

/// <summary>
/// Generic Bounce: No RCPT
/// No recipient could be determined for the message.
Expand Down
Loading