public void TemplateMetadataResolver_GivenGeneratorRegisteredInCorrectly_NoGeneratorReturned() { //Arrange Exception exception = null; TemplateMetadataResolver templateMetadataResolver = CreateTemplateResolver(); //Act templateMetadataResolver.Register("2.0", CreateTemplateGenerator(_schemaVersion)); bool contains = templateMetadataResolver.Contains(_schemaVersion); try { ITemplateMetadataGenerator generator = templateMetadataResolver.GetService(_schemaVersion); } catch (Exception ex) { exception = ex; } //Assert contains .Should() .Be(false); exception.Message .Should() .Be($"Unable to find a registered resolver for schema version : {_schemaVersion}"); }
public void TemplateMetadataResolver_GivenGeneratorRegisteredCorrectly_ReturnsCorrectGenerator() { //Arrange TemplateMetadataResolver templateMetadataResolver = CreateTemplateResolver(); //Act templateMetadataResolver.Register(_schemaVersion, CreateTemplateGenerator(_schemaVersion)); bool contains = templateMetadataResolver.Contains(_schemaVersion); ITemplateMetadataGenerator generator = templateMetadataResolver.GetService(_schemaVersion); //Assert contains .Should() .Be(true); AssertionExtensions.Should((object)generator) .BeOfType <TemplateMetadataGenerator>(); }