public void ReflectNouns_HappyPath(Dictionary <string, Noun> expectedResponse, Assembly inputAssembly) { var routeAttributeReflector = new RouteAttributeReflector(SerilogFixture.UsefullLogger <RouteAttributeReflector>()); var sut = new RouteMetadataBuilder(SerilogFixture.UsefullLogger <RouteMetadataBuilder>(), routeAttributeReflector); var actualResponse = sut.GetMetadata(inputAssembly); actualResponse.Keys.Should().Contain(expectedResponse.Keys); foreach (var expectedKvp in expectedResponse) { var actualNoun = actualResponse[expectedKvp.Key]; actualNoun.Verbs.Should().NotBeNull(); actualNoun.Verbs.Keys.Should().Contain(expectedKvp.Value.Verbs.Keys); foreach (var expectedVerbKvp in expectedKvp.Value.Verbs) { var actualVerb = actualNoun.Verbs[expectedVerbKvp.Key]; actualVerb.Options.Should().NotBeNull(); actualVerb.Options.Keys.Should().Contain(expectedVerbKvp.Value.Options.Keys); foreach (var expectedOptionKvp in expectedVerbKvp.Value.Options) { var actualOption = actualVerb.Options[expectedOptionKvp.Key]; expectedOptionKvp.Value.Should().BeEquivalentTo(actualOption, options => options.Excluding(option => option.PropertyInfo)); } } } }
private static Dictionary <string, Noun> LoadRoutingMetadata() { var inputAssembly = typeof(BaseRequest).Assembly; var routeAttributeReflector = new RouteAttributeReflector(SerilogFixture.UsefullLogger <RouteAttributeReflector>()); var sut = new RouteMetadataBuilder(SerilogFixture.UsefullLogger <RouteMetadataBuilder>(), routeAttributeReflector); var actualResponse = sut.GetMetadata(inputAssembly); return(actualResponse); }
public void ReflectNouns_HappyPath(Dictionary <string, NounAttribute> expectedResponse, Assembly inputAssembly) { var sut = new RouteAttributeReflector(SerilogFixture.UsefullLogger <RouteAttributeReflector>()); var actualResponse = sut.ReflectNouns(inputAssembly); actualResponse.Keys.Should().Contain(expectedResponse.Keys); foreach (var expected in expectedResponse) { var actual = actualResponse[expected.Key]; actual.Should().BeEquivalentTo(expected.Value); } }
public void ReflectOptions_HappyPath(Dictionary <string, Tuple <OptionAttribute, PropertyInfo> > expectedResponse, Type inputType) { var sut = new RouteAttributeReflector(SerilogFixture.UsefullLogger <RouteAttributeReflector>()); var actualResponse = sut.ReflectOptions(inputType); actualResponse.Keys.Should().Contain(expectedResponse.Keys); foreach (var expected in expectedResponse) { var actual = actualResponse[expected.Key]; actual.Item1.Should().BeEquivalentTo(expected.Value.Item1); } }
public void ReflectVerbs_HappyPath(Dictionary <string, Tuple <VerbAttribute, Type> > expectedResponse, Assembly inputAssembly, string inputAssocicatedNounName) { var sut = new RouteAttributeReflector(SerilogFixture.UsefullLogger <RouteAttributeReflector>()); var actualResponse = sut.ReflectVerbs(inputAssembly, inputAssocicatedNounName); actualResponse.Keys.Should().Contain(expectedResponse.Keys); foreach (var expectedPair in expectedResponse) { var actual = actualResponse[expectedPair.Key]; //actual.Should().BeEquivalentTo(expectedPair.Value); actual.Item1.Should().BeEquivalentTo(expectedPair.Value.Item1); actual.Item2.Should().Be(expectedPair.Value.Item2); } }
public RouteMetadataBuilderFixture() { WithRouteAttribueReflector = new RouteAttributeReflector(SerilogFixture.UsefullLogger <RouteAttributeReflector>()); }