public async Task DoesNotGenerateValueType() { var generator = new Gen.Generator(); var interceptor = GeneratorOutputInterceptor.CreateInterceptor(generator); var generatedFiles = await generator.GenerateAsync(typeof(IRecursiveConstraintInterfaceWithStructConstraint <>).Assembly); Assert.DoesNotContain("value-type.ts", generatedFiles); Assert.DoesNotContain(typeof(ValueType), interceptor.GeneratedOutputs.Values.Select(o => o.GeneratedFor)); }
public async Task DoesNotContainIgnoredBases() { var generator = new Gen.Generator(); var interceptor = GeneratorOutputInterceptor.CreateInterceptor(generator); var generatedFiles = await generator.GenerateAsync(typeof(IIgnoresBaseInterface).Assembly); Assert.DoesNotContain("ignored-base-class.ts", generatedFiles); Assert.DoesNotContain(typeof(IgnoredBaseClass), interceptor.GeneratedOutputs.Values.Select(o => o.GeneratedFor)); Assert.DoesNotContain("i-ignored-base-interface.ts", generatedFiles); Assert.DoesNotContain(typeof(IIgnoredBaseInterface), interceptor.GeneratedOutputs.Values.Select(o => o.GeneratedFor)); }
public async Task TestGenerate(Type type, string expectedLocation) { var readExpectedTask = EmbededResourceReader.GetEmbeddedResourceAsync(expectedLocation); var generator = new Gen.Generator(); var interceptor = GeneratorOutputInterceptor.CreateInterceptor(generator); await generator.GenerateAsync(type.Assembly); var expected = (await readExpectedTask).Trim(); Assert.True(interceptor.GeneratedOutputs.ContainsKey(type)); Assert.Equal(expected, FromatOutput(interceptor.GeneratedOutputs[type].Content)); }