Repository: dotnet/aspnetcore
File: src/OpenApi/test/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests/SchemaTests.cs (C#)

Code before:
            Assert.Equal("The project that contains Todo items.", project.Description);

            path = document.Paths["/board"].Operations[HttpMethod.Post];
            var board = path.RequestBody.Content["application/json"].Schema;
            Assert.Equal("An item on the board.", board.Description);

            path = document.Paths["/protected-internal-element"].Operations[HttpMethod.Post];
            var element = path.RequestBody.Content["application/json"].Schema;
            Assert.Equal("The unique identifier for the element.", element.Properties["name"].Description);
            Assert.Equal("Can find this XML comment.", element.Description);

            path = document.Paths["/project-record"].Operations[HttpMethod.Post];
            project = path.RequestBody.Content["application/json"].Schema;

            Assert.Equal("The name of the project.", project.Properties["name"].Description);
            Assert.Equal("The description of the project.", project.Properties["description"].Description);

            path = document.Paths["/todo-with-description"].Operations[HttpMethod.Post];
            todo = path.RequestBody.Content["application/json"].Schema;
            // Test different XML comment scenarios for properties:
            // Id: only <summary> tag -> uses summary directly
            Assert.Equal("The identifier of the todo.", todo.Properties["id"].Description);
            // Name: only <value> tag -> uses value directly
            Assert.Equal("The name of the todo.", todo.Properties["name"].Description);
            // Description: both <summary> and <value> tags -> combines with newline separator
            Assert.Equal("A description of the the todo.\nAnother description of the todo.", todo.Properties["description"].Description);

            path = document.Paths["/type-with-examples"].Operations[HttpMethod.Post];
            var typeWithExamples = path.RequestBody.Content["application/json"].Schema;

            var booleanTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["booleanType"].Example);
            Assert.True(booleanTypeExample.GetValue<bool>());

            var integerTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["integerType"].Example);
            Assert.Equal(42, integerTypeExample.GetValue<int>());

            var longTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["longType"].Example);
            Assert.Equal(1234567890123456789, longTypeExample.GetValue<long>());

            var doubleTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["doubleType"].Example);
            Assert.Equal(3.14, doubleTypeExample.GetValue<double>());

            var floatTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["floatType"].Example);
            Assert.Equal(3.14f, floatTypeExample.GetValue<float>());

            var dateTimeTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["dateTimeType"].Example);
            Assert.Equal(new DateTime(2022, 01, 01), dateTimeTypeExample.GetValue<DateTime>());

            var dateOnlyTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["dateOnlyType"].Example);
            Assert.Equal("2022-01-01", dateOnlyTypeExample.GetValue<string>());


Review comment (refactor):
There's a duplicated word 'the' in the expected string. It should be 'A description of the todo.' instead of 'A description of the the todo.'
```suggestion
            Assert.Equal("A description of the todo.\nAnother description of the todo.", todo.Properties["description"].Description);
```

Code after:
            Assert.Equal("The project that contains Todo items.", project.Description);

            path = document.Paths["/board"].Operations[HttpMethod.Post];
            var board = path.RequestBody.Content["application/json"].Schema;
            Assert.Equal("An item on the board.", board.Description);

            path = document.Paths["/protected-internal-element"].Operations[HttpMethod.Post];
            var element = path.RequestBody.Content["application/json"].Schema;
            Assert.Equal("The unique identifier for the element.", element.Properties["name"].Description);
            Assert.Equal("Can find this XML comment.", element.Description);

            path = document.Paths["/project-record"].Operations[HttpMethod.Post];
            project = path.RequestBody.Content["application/json"].Schema;

            Assert.Equal("The name of the project.", project.Properties["name"].Description);
            Assert.Equal("The description of the project.", project.Properties["description"].Description);

            path = document.Paths["/todo-with-description"].Operations[HttpMethod.Post];
            todo = path.RequestBody.Content["application/json"].Schema;
            // Test different XML comment scenarios for properties:
            // Id: only <summary> tag -> uses summary directly
            Assert.Equal("The identifier of the todo.", todo.Properties["id"].Description);
            // Name: only <value> tag -> uses value directly
            Assert.Equal("The name of the todo.", todo.Properties["name"].Description);
            // Description: both <summary> and <value> tags -> combines with newline separator
            Assert.Equal($"A description of the the todo.\nAnother description of the todo.", todo.Properties["description"].Description);

            path = document.Paths["/type-with-examples"].Operations[HttpMethod.Post];
            var typeWithExamples = path.RequestBody.Content["application/json"].Schema;

            var booleanTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["booleanType"].Example);
            Assert.True(booleanTypeExample.GetValue<bool>());

            var integerTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["integerType"].Example);
            Assert.Equal(42, integerTypeExample.GetValue<int>());

            var longTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["longType"].Example);
            Assert.Equal(1234567890123456789, longTypeExample.GetValue<long>());

            var doubleTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["doubleType"].Example);
            Assert.Equal(3.14, doubleTypeExample.GetValue<double>());

            var floatTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["floatType"].Example);
            Assert.Equal(3.14f, floatTypeExample.GetValue<float>());

            var dateTimeTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["dateTimeType"].Example);
            Assert.Equal(new DateTime(2022, 01, 01), dateTimeTypeExample.GetValue<DateTime>());

            var dateOnlyTypeExample = Assert.IsAssignableFrom<JsonNode>(typeWithExamples.Properties["dateOnlyType"].Example);
            Assert.Equal("2022-01-01", dateOnlyTypeExample.GetValue<string>());