public void Non_Json_UiConfig_Should_Throw_ArgumentException() { // Arrange var options = new Mock <IOptions <InitializrServiceOptions> >(); options.Setup(opts => opts.Value).Returns(new InitializrServiceOptions { UiConfig = new Dictionary <string, string> { { "Path", "Steeltoe.InitializrService.dll" } } }); var logger = new NullLogger <UiConfigFile>(); // Act Action act = () => { var _ = new UiConfigFile(options.Object, logger); }; // Assert act.Should().Throw <System.Text.Json.JsonException>(); }
public void Directory_UiConfig_Path_Should_Throw_ArgumentException() { // Arrange var options = new Mock <IOptions <InitializrServiceOptions> >(); options.Setup(opts => opts.Value).Returns(new InitializrServiceOptions { UiConfig = new Dictionary <string, string> { { "Path", "." } } }); var logger = new NullLogger <UiConfigFile>(); // Act Action act = () => { var _ = new UiConfigFile(options.Object, logger); }; // Assert act.Should().Throw <ArgumentException>() .WithMessage("UI configuration file path is not a file or cannot be read: ."); }