public void Given_Null_Path_When_GetSchemaAsync_Invoked_Then_It_Should_Throw_Exception(string location) { var instance = new FileSystemSchemaSink(location); Func <Task> func = async() => await instance.GetSchemaAsync(null).ConfigureAwait(false); func.Should().Throw <ArgumentNullException>(); }
public async Task Given_Location_When_GetSchemaAsync_Invoked_Then_It_Should_Return_Result() { var location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var path = "default.json"; var instance = new FileSystemSchemaSink(location); var result = await instance.GetSchemaAsync(path).ConfigureAwait(false); result.Should().NotBeNull(); }
public void Given_Invalid_Path_When_GetSchemaAsync_Invoked_Then_It_Should_Throw_Exception(string location, string path) { var file = new Mock <IFileWrapper>(); file.Setup(p => p.Exists(It.IsAny <string>())).Returns(false); var instance = new FileSystemSchemaSink(location) { File = file.Object }; Func <Task> func = async() => await instance.GetSchemaAsync(path).ConfigureAwait(false); func.Should().Throw <FileNotFoundException>(); }