Skip to content

Commit

Permalink
fix build (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
feinoujc authored Nov 20, 2023
1 parent 56448a5 commit 6b419b9
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 32 deletions.
13 changes: 5 additions & 8 deletions Mandrill.net.sln
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34302.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3D7BA565-AE66-447A-AF77-81106169A83A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A359CB29-3E2A-4A41-A897-725C5A0888C6}"
ProjectSection(SolutionItems) = preProject
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EF1B7483-88D5-4E7B-A194-E7375C9E1227}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "tests\Tests.csproj", "{46BA8A52-1F53-4099-9F62-540D149F287D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mandrill.net", "src\Mandrill.net\Mandrill.net.csproj", "{29C93DA7-379F-40CA-9BF3-0F6AA006E28E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mandrill.net.Extensions.DependencyInjection", "src\Mandrill.net.Extensions.DependencyInjection\Mandrill.net.Extensions.DependencyInjection.csproj", "{2D86B07D-408A-4239-AEB7-143DA31362BC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mandrill.net.Extensions.DependencyInjection", "src\Mandrill.net.Extensions.DependencyInjection\Mandrill.net.Extensions.DependencyInjection.csproj", "{2D86B07D-408A-4239-AEB7-143DA31362BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
11 changes: 2 additions & 9 deletions src/Mandrill.net/Mandrill.net.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>8.2.0</VersionPrefix>
<VersionPrefix>8.3.0</VersionPrefix>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -29,13 +29,6 @@


<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="[12.0.1,)" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Net.Http" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Newtonsoft.Json" Version="[13.0.3,)" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Mandrill.net/Model/Messages/MandrillAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public class MandrillAttachment
{
public MandrillAttachment()
{

}

public MandrillAttachment(string type, string name, byte[] content)
{
Type = type;
Expand Down
4 changes: 2 additions & 2 deletions src/Mandrill.net/Model/Messages/MandrillAttachmentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum MandrillAttachmentType
public class MandrillAttachmentMime
{
public static string GetMimeType(MandrillAttachmentType mime) => _mimeTypes[mime.ToString()];
static Dictionary<string, string> _mimeTypes = new Dictionary<string, string>{
static Dictionary<string, string> _mimeTypes = new Dictionary<string, string>{
{ "Jpg", "image/jpeg" },
{ "Jpeg", "image/jpeg" },
{ "Png", "image/png" },
Expand Down Expand Up @@ -73,6 +73,6 @@ public class MandrillAttachmentMime
{ "Mp4", "video/mp4" },
{ "Avi", "video/x-msvideo" }
};

}
}
8 changes: 4 additions & 4 deletions tests/AttachMimeTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ namespace Tests
{
[Trait("Category", "AttachMimeTypes")]
[Collection("AttachMimeTypes")]
public class AttachMimeTypes
public class AttachMimeTypes
{
[Fact]
public void AreAllEnumValuesPresent_ShouldReturnTrueWhenAllValuesPresent()
{
foreach (MandrillAttachmentType myType in Enum.GetValues(typeof(MandrillAttachmentType)))
{
try
{
MandrillAttachmentMime.GetMimeType(myType);
{
MandrillAttachmentMime.GetMimeType(myType);
}
catch (Exception ex)

Check warning on line 26 in tests/AttachMimeTypes.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'ex' is declared but never used

Check warning on line 26 in tests/AttachMimeTypes.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'ex' is declared but never used

Check warning on line 26 in tests/AttachMimeTypes.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'ex' is declared but never used

Check warning on line 26 in tests/AttachMimeTypes.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'ex' is declared but never used

Check warning on line 26 in tests/AttachMimeTypes.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'ex' is declared but never used

Check warning on line 26 in tests/AttachMimeTypes.cs

View workflow job for this annotation

GitHub Actions / test

The variable 'ex' is declared but never used
{
Assert.True(false, $"{myType} is not in MandrillAttachmentMime dictionary");
Assert.Fail($"{myType} is not in MandrillAttachmentMime dictionary");
}
}
Assert.True(true);
Expand Down
2 changes: 1 addition & 1 deletion tests/IntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected IntegrationTest(ITestOutputHelper output)
var apiKey = Environment.GetEnvironmentVariable("MANDRILL_API_KEY");
if (string.IsNullOrEmpty(apiKey))
{
Assert.True(false, "You must set the user environment variable MANDRILL_API_KEY in order to run these tests. " +
Assert.Fail("You must set the user environment variable MANDRILL_API_KEY in order to run these tests. " +
"Go to https://mandrillapp.com/ to obtain an api key.");
}
return apiKey;
Expand Down
2 changes: 1 addition & 1 deletion tests/MandrillApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task MandrillApi_ctor_non_default_client_controls_its_lifecycle()
}
catch (ObjectDisposedException)
{
Assert.False(true, "Should not have been disposed");
Assert.Fail("Should not have been disposed");
}
catch (HttpRequestException)
{
Expand Down
10 changes: 5 additions & 5 deletions tests/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void AssertResults(IEnumerable<MandrillSendMessageResponse> result)
{
if (response.Status == MandrillSendMessageResponseStatus.Invalid)
{
Assert.True(false, "invalid email: " + response.RejectReason);
Assert.Fail("invalid email: " + response.RejectReason);
}
if (response.Status == MandrillSendMessageResponseStatus.Rejected &&
response.RejectReason == "unsigned")
Expand All @@ -40,7 +40,7 @@ void AssertResults(IEnumerable<MandrillSendMessageResponse> result)
}
if (response.Status == MandrillSendMessageResponseStatus.Rejected)
{
Assert.True(false, "rejected email: " + response.RejectReason);
Assert.Fail("rejected email: " + response.RejectReason);

}

Expand All @@ -50,7 +50,7 @@ void AssertResults(IEnumerable<MandrillSendMessageResponse> result)
break;
}

Assert.True(false, "Unexptected status:" + response.Status);
Assert.Fail("Unexptected status:" + response.Status);
}
}

Expand Down Expand Up @@ -390,11 +390,11 @@ public async Task Can_send_message()
};
message.Images.Add(new MandrillImage("image/png", "mandrill_logo", TestData.PngImage));
message.Attachments.Add(new MandrillAttachment("text/plain", "message.txt", Encoding.UTF8.GetBytes("This is an attachment.\n")));
message.Attachments.Add(new MandrillAttachment(MandrillAttachmentType.Txt, "message.txt", Encoding.UTF8.GetBytes("This is an attachment.\n")));
message.Attachments.Add(new MandrillAttachment(MandrillAttachmentType.Txt, "message2.txt", Encoding.UTF8.GetBytes("This is also an attachment.\n")));

var result = await Api.Messages.SendAsync(message);

result.Should().HaveCount(3);
result.Should().HaveCount(2);
AssertResults(result);
}

Expand Down

0 comments on commit 6b419b9

Please sign in to comment.