private async Task AssertTestCase_SingleExpression(WhenChangedHostBuilder hostTypeInfo, BaseUserSourceBuilder hostPropertyTypeInfo, bool typesHaveSameRoot) { hostTypeInfo.WithInvocation(InvocationKind.MemberAccess, x => x.Value); var propertyTypeSource = typesHaveSameRoot ? string.Empty : hostPropertyTypeInfo.BuildRoot(); var fixture = await WhenChangedFixture.Create(hostTypeInfo, x => TestContext.WriteLine(x), ("PropertyTypeSource.cs", propertyTypeSource)).ConfigureAwait(false); fixture.RunGenerator(out var compilationDiagnostics, out var generatorDiagnostics); generatorDiagnostics.Where(x => x.Severity >= DiagnosticSeverity.Warning).Should().BeEmpty(); compilationDiagnostics.Where(x => x.Severity >= DiagnosticSeverity.Warning).Should().BeEmpty(); var host = fixture.NewHostInstance(); host.Value = fixture.NewValuePropertyInstance(); var observable = host.GetWhenChangedObservable(_ => TestContext.WriteLine(fixture.Sources)); object value = null; observable.Subscribe(x => value = x); host.Value.Should().Be(value); host.Value = fixture.NewValuePropertyInstance(); host.Value.Should().Be(value); host.Value = null; host.Value.Should().Be(value); }