public BaseHandlerIntegrationTest() { var _applicationConfiguration = new ApplicationConfiguration(); var configurationRoot = TestHelper.GetConfigurationRoot(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); configurationRoot.Bind(_applicationConfiguration); var consoleWriter = new ConsoleWriter(SerilogFixture.UsefullLogger <ConsoleWriter>()); var authTokenFactory = new OAuthTokenFactory(SerilogFixture.UsefullLogger <OAuthTokenFactory>(), _applicationConfiguration); var clientFactory = new ClientProxyFactory(SerilogFixture.UsefullLogger <ClientProxyFactory>(), authTokenFactory, _applicationConfiguration); //var fileHandler = new FileHandlerMock() {ReadFile = FileHandlerMock.WithReadFileAsNoOp(), WriteFile = FileHandlerMock.WithWriteFileAsNoOp()}.Build(); var fileHandler = new FileHandler(SerilogFixture.UsefullLogger <FileHandler>()); SchemaClient = clientFactory.GetClientProxy <ISquidexAppSchemaClient>("aut-developer"); SchemaImportSystemUnderTest = new SchemaImportHandler(SerilogFixture.UsefullLogger <SchemaImportHandler>(), clientFactory, consoleWriter, null); SchemaExportSystemUnderTest = new SchemaExportHandler(SerilogFixture.UsefullLogger <SchemaExportHandler>(), clientFactory, consoleWriter, null); SchemaDeleteSystemUnderTest = new SchemaDeleteHandler(SerilogFixture.UsefullLogger <SchemaDeleteHandler>(), clientFactory, consoleWriter, null); SchemaListSystemUnderTest = new SchemaListHandler(SerilogFixture.UsefullLogger <SchemaListHandler>(), clientFactory, consoleWriter, null); //var schemaTagHandler = new SchemaTagHandler(SerilogFixture.UsefullLogger<ContentDeleteSystemUnderTest>(), clientFactory, null); ContentClient = clientFactory.GetClientProxy <ISquidexContentClient>("aut-developer"); ContentImportSystemUnderTest = new ContentImportHandler(SerilogFixture.UsefullLogger <ContentImportHandler>(), clientFactory, consoleWriter, null); ContentExportSystemUnderTest = new ContentExportHandler(SerilogFixture.UsefullLogger <ContentExportHandler>(), clientFactory, consoleWriter, null); ContentDeleteSystemUnderTest = new ContentDeleteHandler(SerilogFixture.UsefullLogger <ContentDeleteHandler>(), clientFactory, consoleWriter, null); ContentPostSystemUnderTest = new ContentPostHandler(SerilogFixture.UsefullLogger <ContentImportHandler>(), clientFactory, consoleWriter, null); AttachmentClient = clientFactory.GetClientProxy <ISquidexAttachmentClient>("aut-developer"); AttachmentImportSystemUnderTest = new AssetImportHandler(SerilogFixture.UsefullLogger <AssetImportHandler>(), clientFactory, consoleWriter, null); AttachmentExportSystemUnderTest = new AssetExportHandler(SerilogFixture.UsefullLogger <AssetExportHandler>(), clientFactory, consoleWriter, null); AttachmentDeleteSystemUnderTest = new AssetDeleteHandler(SerilogFixture.UsefullLogger <AssetDeleteHandler>(), clientFactory, consoleWriter, null); AttachmentListSystemUnderTest = new AssetListHandler(SerilogFixture.UsefullLogger <AssetListHandler>(), clientFactory, consoleWriter, null); AttachmentTagSystemUnderTest = new AssetTagHandler(SerilogFixture.UsefullLogger <AssetTagHandler>(), clientFactory, consoleWriter, null); AssetUpdateContentSystemUnderTest = new AssetUpdateContentHandler(SerilogFixture.UsefullLogger <AssetUpdateContentHandler>(), clientFactory, consoleWriter, null); }
public void ParseAndPopulateOptions_HappyPath(Noun expectedNoun, Noun inputNoun, string commandLine) { // remember : inputNoun is partially pre-populated; ParseAndPopulateOptions is to fill in the // values for any options that have been defined. var sut = new RouteOptionsParser(SerilogFixture.UsefullLogger <RouteOptionsParser>()); sut.ParseAndPopulateOptions(ref inputNoun, commandLine.Split(' ')); inputNoun.Should().NotBeNull(); inputNoun.Verbs.Should().HaveCount(1); inputNoun.Verbs.Single().Value.Should().NotBeNull(); var expectedOptions = expectedNoun.Verbs.Single().Value.Options; var actualOptions = inputNoun.Verbs.Single().Value.Options; actualOptions.Keys.Should().Contain(expectedOptions.Keys); foreach (var currentKey in expectedOptions.Keys) { var currentExpectedOption = expectedOptions[currentKey]; var currentActualOption = actualOptions[currentKey]; currentActualOption.Should().BeEquivalentTo(currentExpectedOption); } }
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)); } } } }
public StaticCommandLineRouterFixture() { WithRouteCommandParser = new RouteCommandsParser(SerilogFixture.UsefullLogger <RouteCommandsParser>()); WithRouteOptionsParser = new RouteOptionsParser(SerilogFixture.UsefullLogger <RouteOptionsParser>()); WithRouteRequestBuilder = new RouteRequestBuilder(SerilogFixture.UsefullLogger <RouteRequestBuilder>()); WithRouteValidator = new RouteRequestValidatorFixture().Build(); }
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 ParseAndPopulateOperation_HappyPath(Noun expectedNounVerbPair, string commandLine) { var preCachedNouns = new Noun[] { new AppNoun(), new AssetNoun(), new ContentNoun(), new SchemaNoun() }; var sut = new RouteCommandsParser(SerilogFixture.UsefullLogger <RouteCommandsParser>()); var actualNounVerbPair = sut.ParseAndPopulateOperation(preCachedNouns, commandLine.Split(' ')); actualNounVerbPair.Should().BeEquivalentTo(expectedNounVerbPair); }
public void MapOperation_HappyPath(IRequest expectedRequest, Noun noun) { var sut = new RouteRequestBuilder(SerilogFixture.UsefullLogger <RouteRequestBuilder>()); var actualRequest = sut.GetRequestForVerb(noun); actualRequest.Should().NotBeNull(); if (expectedRequest is AppLoginRequest expectedAppLoginRequest && actualRequest is AppLoginRequest actualAppLoginRequest) { actualAppLoginRequest.Should().BeEquivalentTo(expectedAppLoginRequest); }
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>()); }
public IBuildRouteMetadata Build() { return(new RouteMetadataBuilder(SerilogFixture.UsefullLogger <RouteMetadataBuilder>(), WithRouteAttribueReflector)); }
public IValidateRouteRequests Build() { return(new RouteRequestValidator(SerilogFixture.UsefullLogger <RouteRequestValidator>())); }
public IClientProxyFactory Build() { return(new ClientProxyFactory(SerilogFixture.UsefullLogger <ClientProxyFactory>(), this.OAuthTokenFactory, this.ApplicationConfiguration)); }
public IOAuthTokenFactory Build() { return(new OAuthTokenFactory(SerilogFixture.UsefullLogger <OAuthTokenFactory>(), this.ApplicationConfiguration)); }
public StaticCommandLineRouter Build() { return(new StaticCommandLineRouter(SerilogFixture.UsefullLogger <RouteOptionsParser>(), WithRouteCommandParser, WithRouteOptionsParser, WithRouteRequestBuilder, WithRouteValidator)); }