public void ParserCreateParserCreatesAndSetsUpTheFormatSpecificParser() { // Arrange Stream s = null; try { s = Parser.OpenTraceFile("WithMessageBodies.svclog"); // Act typeType wcfFormatParser = TestHelper.CreateConfigTypeForWcfFormatParser(); using (Parser p = Parser.CreateParser(wcfFormatParser, s, "test", true, false, SoapActionMode.Include)) { s = null; // Assert Assert.IsNotNull(p); // checks it is created // Check it is setup p.ReadNextRequest(); } } finally { if (s != null) { s.Dispose(); } } }
public static TConfigured CreateConfiguredType <TConfigured>(typeType configuredTypeName) where TConfigured : class { if (configuredTypeName == null) { throw new ArgumentNullException("configuredTypeName"); } TConfigured ans = null; string assemblyQualifiedName = configuredTypeName.type + "," + configuredTypeName.assembly; try { Type configuredType = Type.GetType(assemblyQualifiedName, true, false); ans = Activator.CreateInstance(configuredType) as TConfigured; if (ans == null) { throw new UserException(string.Format(CultureInfo.CurrentCulture, Messages.ConfiguredTypeMismatch, assemblyQualifiedName, typeof(TConfigured).FullName)); } } catch (IOException fle) { throw new UserException(string.Format(CultureInfo.CurrentCulture, Messages.ConfiguredTypeLoadError, assemblyQualifiedName, fle.Message)); } catch (TypeLoadException tle) { throw new UserException(string.Format(CultureInfo.CurrentCulture, Messages.ConfiguredTypeLoadError, assemblyQualifiedName, tle.Message)); } catch (MemberAccessException mae) { throw new UserException(string.Format(CultureInfo.CurrentCulture, Messages.ConfiguredTypeLoadError, assemblyQualifiedName, mae.Message)); } return(ans); }
/// <summary> /// Creates the configuration type for the <see cref="FiddlerTextParser"/>. /// </summary> /// <returns>The configuration type for the <see cref="FiddlerTextParser"/></returns> internal static typeType CreateConfigTypeForFiddlerTextFormatParser() { typeType wcfFormatParser = new typeType(); wcfFormatParser.assembly = TestHelper.LibraryAssembly; wcfFormatParser.type = "Microsoft.WcfUnit.Library.FiddlerTextParser"; return(wcfFormatParser); }
public void UTILCreateConfiguredType() { // Arrange typeType t = TestHelper.CreateConfigTypeForWcfFormatParser(); // Act using (IFormatParser dummy = Utility.CreateConfiguredType <IFormatParser>(t)) { // Assert Assert.IsNotNull(dummy); Assert.IsInstanceOfType(dummy, typeof(WcfParser)); } }
public void UTILCreateConfiguredTypeThrowsExceptionIfTypeDoesNotHaveParameterlessConstructor() { // Arrange typeType t = new typeType(); t.assembly = TestHelper.LibraryAssembly; t.type = "Microsoft.WcfUnit.Library.Parser"; // Act and assert TestHelper.TestForUserException( delegate { using (Parser dummy = Utility.CreateConfiguredType <Parser>(t)) { } }); }
public void UTILCreateConfiguredTypeThrowsExceptionIfTypeDoesNotMatch() { // Arrange typeType t = new typeType(); t.assembly = TestHelper.LibraryAssembly; t.type = "Microsoft.WcfUnit.Library.FiddlerTextParser"; // Act and assert TestHelper.TestForUserException( delegate { using (WcfParser dummy = Utility.CreateConfiguredType <WcfParser>(t)) { } }); }
public void UTILCreateConfiguredTypeThrowsExceptionIfTypeNotFound() { // Arrange typeType t = new typeType(); t.assembly = TestHelper.LibraryAssembly; t.type = "NonExistent"; // Act and assert TestHelper.TestForUserException( delegate { using (IFormatParser dummy = Utility.CreateConfiguredType <IFormatParser>(t)) { } }); }
public static Parser CreateParser(typeType formatParserType, Stream traceFile, string fileName, bool clientTrace, bool serviceTrace, SoapActionMode soapActionMode, params string[] soapActions) { IFormatParser formatParser = null; if (formatParserType == null) { formatParser = new WcfParser(); } else { formatParser = Utility.CreateConfiguredType <IFormatParser>(formatParserType); } formatParser.Setup(traceFile, fileName, clientTrace, serviceTrace); Parser ans = new Parser(formatParser, soapActionMode, soapActions); return(ans); }
public void ParserIsDisposable() { // Arrange Stream s = null; try { s = Parser.OpenTraceFile("WithMessageBodies.svclog"); // Act and assert typeType wcfFormatParser = TestHelper.CreateConfigTypeForWcfFormatParser(); using (Parser p = Parser.CreateParser(wcfFormatParser, s, "test", true, false, SoapActionMode.Include)) { s = null; } } finally { if (s != null) { s.Dispose(); } } }
public titleEltType() { this.typeField = typeType.title; }
public simple() { this.typeField = typeType.simple; }
public extended() { this.typeField = typeType.extended; }
public arcType() { this.typeField = typeType.arc; }
public MetadataURLType() { this.typeField = typeType.simple; }
public RecordType_Type() { this.typeField = typeType.simple; }
public MemberPropertyType() { this.typeField = typeType.simple; }
public OnlineResourceType() { this.typeField = typeType.simple; }
public locatorType() { this.typeField = typeType.locator; }
public resourceType() { this.typeField = typeType.resource; }
public MetadataType() { this.typeField = typeType.simple; }
public MetadataType() { this.type = typeType.simple; }