public void ThrowsExceptionIfResourceNotFound() { var attribute = new JsonResourceDataAttribute("Foo"); var methodInfo = this.GetType().GetMethod(nameof(ThrowsExceptionIfResourceNotFound)); Assert.Throws<ResourceNotFoundException>(() => attribute.GetData(methodInfo)); }
public void ThrowsFileNotSupportedWithObjectJson() { var attribute = new JsonResourceDataAttribute("Dms.Xunit.TheoryData.Test.TestFiles.Object.json"); var methodInfo = this.GetType().GetMethod(nameof(ThrowsFileNotSupportedWithObjectJson)); Assert.Throws<FileNotSupportedException>(() => attribute.GetData(methodInfo).ToArray()); }
public void ExceptionSuggestsFoundResources() { var attribute = new JsonResourceDataAttribute("Foo"); var methodInfo = this.GetType().GetMethod(nameof(ExceptionSuggestsFoundResources)); var exception = Assert.Throws<ResourceNotFoundException>(() => attribute.GetData(methodInfo)); Assert.Contains("Dms.Xunit.TheoryData.Test.TestFiles.ObjectRecord.json", exception.Message); Assert.Contains("Dms.Xunit.TheoryData.Test.TestFiles.SingleRecord.json", exception.Message); }