Skip to content

Commit

Permalink
Merge pull request #31 from prplecake/fix-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prplecake committed Mar 29, 2023
2 parents 2a45257 + 493c970 commit 8bd9867
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ namespace BookmarkSync.Infrastructure.Tests.Services;
public class BookmarkingServiceTests
{
[TestMethod]
public void GetBookmarkingService_Pinboard()
[ExpectedException(typeof(InvalidOperationException))]
public void GetBookmarkingService_Exception()
{
// Arrange
var config = new Dictionary<string, string?>
{
{
"App:Bookmarking:Service", "Pinboard"
},
{
"App:Bookmarking:ApiToken", "secret:123456789"
"App:Bookmarking:Service", "Nonsense"
}
};
var configuration = new ConfigurationBuilder()
Expand All @@ -28,21 +26,21 @@ public void GetBookmarkingService_Pinboard()
IConfigManager configManager = new ConfigManager(configuration);

// Act
var obj = BookmarkingService.GetBookmarkingService(configManager);
var unused = BookmarkingService.GetBookmarkingService(configManager);

// Assert
Assert.AreEqual(obj.GetType(), typeof(PinboardBookmarkingService));
Assert.IsInstanceOfType(obj, typeof(PinboardBookmarkingService));
// Assert - Exception
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void GetBookmarkingService_Exception()
public void GetBookmarkingService_Pinboard()
{
// Arrange
var config = new Dictionary<string, string?>
{
{
"App:Bookmarking:Service", "Nonsense"
"App:Bookmarking:Service", "Pinboard"
},
{
"App:Bookmarking:ApiToken", "secret:123456789"
}
};
var configuration = new ConfigurationBuilder()
Expand All @@ -52,8 +50,10 @@ public void GetBookmarkingService_Exception()
IConfigManager configManager = new ConfigManager(configuration);

// Act
var unused = BookmarkingService.GetBookmarkingService(configManager);
var obj = BookmarkingService.GetBookmarkingService(configManager);

// Assert - Exception
// Assert
Assert.AreEqual(typeof(PinboardBookmarkingService), obj.GetType());
Assert.IsInstanceOfType(obj, typeof(PinboardBookmarkingService));
}
}

0 comments on commit 8bd9867

Please sign in to comment.