public void Should_return_list_with_both_items_and_DisplayName() { AssertHelper.All( () => _actual.ShouldNotBeNull(), () => _actual.ShouldNotBeEmpty(), () => _actual.Count.ShouldBe(1), () => _actual.First() .Contains(KeyOne) .ShouldBeTrue(), () => _actual.First()[KeyOne] .ShouldBe(ValueOne1), () => _actual.First() .Contains(KeyTwo) .ShouldBeTrue(), () => _actual.First()[KeyTwo] .ShouldBe(ValueTwo2), () => _actual.First() .Contains("DisplayName") .ShouldBeTrue() ); }
public void Should_return_a_list_of_paths_with_correct_content_type_appended_to_schema_reference_for_post_operations() { var paths = _actualPaths.Values; var postOperationReference = paths.Select( p => p.post?.parameters[0] ?.schema?.@ref) .Where(r => r != null); var refContentTypeRegex = new Regex("(\\w+)_(readable|writable)"); AssertHelper.All( postOperationReference .Select( c => (Action) (() => Assert.That( refContentTypeRegex.IsMatch(c), Is.True, $@"Path reference content type {c} does not match expected pattern {"(\\w+)_(readable|writable)"}"))) .ToArray()); }
public void Should_return_a_list_of_paths_with_correct_operation_content_types() { var paths = _actualPaths.Values; var pathOperationContentTypes = paths.SelectMany(p => p.get?.produces ?? Enumerable.Empty <string>()) .Concat( paths.SelectMany( p => p.put?.consumes ?? Enumerable.Empty <string>())) .Concat( paths.SelectMany( p => p.post?.consumes ?? Enumerable.Empty <string>())) .Concat( paths.SelectMany( p => p.delete?.consumes ?? Enumerable.Empty <string>())); var operationContentTypeRegex = new Regex( "application\\/vnd.ed-fi.(\\w+).test-parentnonabstractbaseclass-excludeonly.(readable|writable)\\+json"); AssertHelper.All( pathOperationContentTypes .Select( c => (Action) (() => Assert.That( operationContentTypeRegex.IsMatch(c), Is.True, $@"Path operation content type {c} does not match expected pattern { "application/vnd.ed-fi.(\\w+).Test-parentnonabstractbaseclass-excludeonly.(readable|writable)+json" }."))) .ToArray()); }
public void Should_return_a_correctly_constructed_resource_reference_definition_specified_in_composite_definition() { var expectedReferenceDefinitionName = "assessment_objectiveAssessment_objectiveAssessmentLearningObjective_learningObjectiveLearningStandard"; var expectedReferenceProperties = new[] { "id", "description", "learningStandardId", "namespace", "courseTitle", "learningStandardItemCode", "successCriteria", "uri", "learningStandardIdentificationCodes" }; Schema actualReferenceDefinition; _actualDefinitions.TryGetValue(expectedReferenceDefinitionName, out actualReferenceDefinition); AssertHelper.All( () => Assert.That( actualReferenceDefinition, Is.Not.Null, $"No definition found for expected reference definition {expectedReferenceDefinitionName}"), () => Assert.That(actualReferenceDefinition.properties.Keys, Is.EquivalentTo(expectedReferenceProperties))); }
public void Should_return_an_error_body_indicating_an_invalid_scope_was_supplied() { AssertHelper.All( () => _tokenError.Error.ShouldBe(TokenErrorType.InvalidScope), () => _tokenError.Error_description.ShouldBe( "The supplied 'scope' was not a number (it should be an EducationOrganizationId that is explicitly associated with the client).")); }
public void Should_return_true_for_an_assessment_resource() { AssertHelper.All( () => Assert.That(AssessmentSpecification.IsAssessmentEntity(typeof(ModelResources.Assessment.EdFi.Assessment)), Is.True), () => Assert.That(AssessmentSpecification.IsAssessmentEntity(nameof(ModelResources.Assessment.EdFi.Assessment)), Is.True) ); }
public void Should_return_an_error_body_indicating_an_invalid_scope_was_supplied() { AssertHelper.All( () => _tokenError.Error.ShouldBe(TokenErrorType.InvalidScope), () => _tokenError.Error_description.ShouldBe( "The client is not explicitly associated with the EducationOrganizationId specified in the requested 'scope'.")); }
public void Should_Contain_Extended_EdFi_Resource_Extension_Definition_For_Each_Extension() { var expectedExtensions = DomainModelDefinitionsProviderHelper .DomainModelProvider .GetDomainModel() .Entities .Where(e => e.IsEntityExtension && e.EdFiStandardEntityAssociation.OtherEntity.Name == "Staff") .ToList(); var expectedExtensionDefinitions = expectedExtensions .Select(e => e.Schema) .Select( l => _schemaNameMapProvider.GetSchemaMapByPhysicalName(l) .ProperCaseName) .Select(p => $"{p.ToCamelCase()}_staffExtension"); var actualExtensionDefitions = _actualDefinitions.Where( d => d.Key.EndsWith( "_staffExtension")) .Select(d => d.Key); AssertHelper.All( () => Assert.That( actualExtensionDefitions, Is.EquivalentTo(expectedExtensionDefinitions), "Actual extension definitions does not matched expected extension definitions for Staff")); }
public void Should_return_true_for_descriptor_entity() { AssertHelper.All( () => Assert.That(DescriptorEntitySpecification.IsEdFiDescriptorEntity(typeof(CountryDescriptor)), Is.True), () => Assert.That(DescriptorEntitySpecification.IsEdFiDescriptorEntity(nameof(CountryDescriptor)), Is.True) ); }
public void Should_return_true_for_descriptor_resource() { AssertHelper.All( () => Assert.That(DescriptorEntitySpecification.IsEdFiDescriptorEntity(typeof(AbsenceEventCategoryDescriptor)), Is.True), () => Assert.That(DescriptorEntitySpecification.IsEdFiDescriptorEntity(nameof(AbsenceEventCategoryDescriptor)), Is.True) ); }
public void Should_return_correct_propercase_name_segment_for_provided_assembly_name() { AssertHelper.All( () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(Exception))), () => Assert.That(ActualException.Message, Is.EqualTo("The supplied 'aggregateExtensionEntity' was not an aggregate extension.")) ); }
public void Should_be_created_with_all_edfi_resource_definitions_containing_an_ext_property() { // _ext property contains any entity-extensions present for the given edfi resource. AssertHelper.All( _actualExtendableEdfiResourceDefinitions .Select(x => (Action)(() => Assert.That(x.properties.Keys, Has.Member("_ext")))).ToArray()); }
public void Should_return_null_for_missing_enumeration() { var result = TestObjectEnumeration.TryParse("Three", out TestObjectEnumeration enumeration); AssertHelper.All(() => result.ShouldBeFalse(), () => enumeration.ShouldBeNull()); }
public void Should_be_a_valid_swagger_document_for_each_entry() { AssertHelper.All( _actualMetadata.Select(m => OpenApiMetadataHelper.DeserializeSwaggerDocument(m.Metadata)) .Select( swaggerDocument => (Action)(() => Assert.That(swaggerDocument, Is.Not.Null))) .ToArray()); }
public void Should_get_an_object_by_value() { var result = TestObjectEnumeration.TryParse(ObjectOne, out TestObjectEnumeration enumeration); AssertHelper.All(() => result.ShouldBeTrue(), () => enumeration.ShouldNotBeNull(), () => enumeration.ShouldBe(TestObjectEnumeration.One)); }
public void Should_get_an_object_by_int32() { var result = TestEnumeration.TryFromInt32(2, out TestEnumeration enumeration); AssertHelper.All(() => result.ShouldBeTrue(), () => enumeration.ShouldNotBeNull(), () => enumeration.ShouldBe(TestEnumeration.Two)); }
public void Should_RestError_show_composed_constraint_message() { AssertHelper.All( () => actualError.ShouldNotBeNull(), () => actualError.Code = 409, () => actualError.Type = "Conflict" ); }
public virtual void ArgumentException_should_be_thrown_when_Register_Extension_Type_Is_Called() { AssertHelper.All( () => Assert.IsInstanceOf <ArgumentException>(ActualException), () => Assert.That( ActualException.Message, Is.EqualTo($"Ed-Fi type '{typeof(FakeClass).Name}' is the same as the provided extension type '{typeof(FakeClass).Name}'."))); }
public void Should_get_an_object_by_display_name() { var result = TestEnumeration.TryParse("One", out TestEnumeration enumeration); AssertHelper.All(() => result.ShouldBeTrue(), () => enumeration.ShouldNotBeNull(), () => enumeration.ShouldBe(TestEnumeration.One)); }
public void Should_throw_ArgumentNullException() { AssertHelper.All( () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(ArgumentNullException))), () => Assert.That( ActualException.Message.Replace(Environment.NewLine, " "), Is.EqualTo("Value cannot be null. Parameter name: resourceSchemaProperCaseName"))); }
public void Should_get_an_object_by_predicate() { var result = TestEnumeration.TryParse(x => x.DisplayName.Equals("Two"), out TestEnumeration enumeration); AssertHelper.All(() => result.ShouldBeTrue(), () => enumeration.ShouldNotBeNull(), () => enumeration.ShouldBe(TestEnumeration.Two)); }
public void Should_RestError_show_unknown_value_message() { AssertHelper.All( () => actualError.ShouldNotBeNull(), () => actualError.Code = 409, () => actualError.Type = "Conflict" ); }
public void Should_get_an_object_by_predicate() { var result = TestObjectEnumeration.TryParse(x => x.Value == ObjectTwo, out TestObjectEnumeration enumeration); AssertHelper.All(() => result.ShouldBeTrue(), () => enumeration.ShouldNotBeNull(), () => enumeration.ShouldBe(TestObjectEnumeration.Two)); }
public void Should_return_true_for_educationOrganization_Identifier_property() { AssertHelper.All( () => Assert.That( EducationOrganizationEntitySpecification.IsEducationOrganizationIdentifier( nameof(NHibernateEntities.EducationOrganizationAggregate.EdFi.EducationOrganization.EducationOrganizationId)), Is.True) ); }
public void Should_return_the_value_from_the_method_indicated_by_the_signature_used() { AssertHelper.All( () => Assert.That(_actualCallForFirstResult1, Is.EqualTo(2)), () => Assert.That(_actualCallForFirstResult2, Is.EqualTo(1)), () => Assert.That(_actualCallForSecondResult1, Is.EqualTo(6)), () => Assert.That(_actualCallForSecondResult2, Is.EqualTo(7))); }
public void Should_throw_ArgumentNullException_indicating_resourceName_parameter_cannot_be_null() { AssertHelper.All( () => Assert.That(ActualException.GetType(), Is.EqualTo(typeof(ArgumentNullException))), () => Assert.That( ActualException.Message.Replace(Environment.NewLine, " "), Is.EqualTo("Value cannot be null. (Parameter 'resourceName')"))); }
public void Should_return_true_for_educationOrganization_base_entity() { AssertHelper.All( () => Assert.That( EducationOrganizationEntitySpecification.IsEducationOrganizationBaseEntity( nameof(EducationOrganization)), Is.True) ); }
public void Should_have_resource_root_set_properly() { AssertHelper.All( () => Assert.That(_studentExtension.ResourceRoot.FullName, Is.EqualTo(_student.FullName)), () => Assert.That(_studentPet.ResourceRoot.FullName, Is.EqualTo(_student.FullName)), () => Assert.That(_studentPetPreference.ResourceRoot.FullName, Is.EqualTo(_student.FullName)) ); }
public void Should_have_the_is_inherited_childitem_property_set_properly() { AssertHelper.All( () => Assert.That(_educationOrganizationAddresses.IsInheritedChildItem, Is.True), () => Assert.That(_studentExtension.IsInheritedChildItem, Is.False), () => Assert.That(_studentPet.IsInheritedChildItem, Is.False), () => Assert.That(_studentPetPreference.IsInheritedChildItem, Is.False) ); }
public void Should_have_the_resource_extension_class_property_set_properly() { AssertHelper.All( () => Assert.That(_student.IsResourceExtensionClass, Is.False), () => Assert.That(_studentExtension.IsResourceExtensionClass, Is.True), () => Assert.That(_studentPet.IsResourceExtensionClass, Is.False), () => Assert.That(_studentPetPreference.IsResourceExtensionClass, Is.False) ); }