public void UseResponseFile_WithValidData_GetOptionsValueShouldEqualInput(string relativePath, EnvDirectory baseDir) { MiddlewareOptionsBuilder builder = new MiddlewareOptionsBuilder(_dirMapperSvc); string filePath = Path.Combine(_dirMapperSvc.GetAbsolutePath(baseDir), relativePath); File.Create(filePath); builder.UseResponseFromFile(relativePath, baseDir); ResponseFromFileOption option = builder .GetOptions() .GetSingleOrDefault <ResponseFromFileOption>(); option.Value.ShouldNotBeNull(); option.Value.File.Path.ShouldBe(relativePath); option.Value.File.BaseDir.ShouldBe(baseDir); }
public void UseResponseFile_WithInvalidData_ShouldThrow(string relativePath, EnvDirectory baseDir, bool createFile, Type expectedException) { MiddlewareOptionsBuilder builder = new MiddlewareOptionsBuilder(_dirMapperSvc); if (createFile) { string filePath = Path.Combine(_dirMapperSvc.GetAbsolutePath(baseDir), relativePath); File.Create(filePath); } Action testAction = () => { builder.UseResponseFromFile(relativePath, baseDir); }; testAction.ShouldThrow(expectedException); }