public void TypeExtraction_NullEntity() { const string claimName = "PityTheFoolClaim"; Task <string> ExtractionFunc(TestingType testingType) => Task.FromResult(testingType.No); var config = new ValidTypeClaimExtractionConfig <TestingType>(ExtractionFunc, claimName, ClaimLocation.Body); Assert.True(config.ClaimLocation.Equals(ClaimLocation.Body)); Assert.True(config.ExtractionType.Equals(ExtractionType.Type)); try { config.GetClaimAsync(null).Wait(); } catch (AggregateException) { } }
public void TypeExtraction_NullExtractionFunction() { const string claimName = "PityTheFoolClaim"; var config = new ValidTypeClaimExtractionConfig <TestingType>(null, claimName, ClaimLocation.Body); Assert.True(config.ClaimLocation.Equals(ClaimLocation.Body)); Assert.True(config.ExtractionType.Equals(ExtractionType.Type)); var instance = new TestingType() { Yo = "lo", No = "lo" }; try { config.GetClaimAsync(JsonConvert.SerializeObject(instance)).Wait(); } catch (AggregateException) { } }
public void TypeExtraction() { const string claimName = "PityTheFoolClaim"; Task <string> ExtractionFunc(TestingType testingType) => Task.FromResult(testingType.No); var config = new ValidTypeClaimExtractionConfig <TestingType>(ExtractionFunc, claimName, ClaimLocation.Body); Assert.True(config.ClaimLocation.Equals(ClaimLocation.Body)); Assert.True(config.ExtractionType.Equals(ExtractionType.Type)); var instance = new TestingType() { Yo = "lo", No = "lo" }; var result = config.GetClaimAsync(JsonConvert.SerializeObject(instance)).Result; Assert.Equal(instance.No, result.Value); Assert.Equal(claimName, result.Type); }