public void Given_OpenApiPropertyAttribute_Without_Default_When_Visit_Invoked_Then_It_Should_Return_Result(string name, bool nullable, string description) { var acceptor = new OpenApiSchemaAcceptor(); var type = new KeyValuePair <string, Type>(name, typeof(DateTime)); var attribute = new OpenApiPropertyAttribute() { Nullable = nullable, Description = description }; this._visitor.Visit(acceptor, type, this._strategy, attribute); acceptor.Schemas[name].Nullable.Should().Be(nullable); acceptor.Schemas[name].Default.Should().BeNull(); acceptor.Schemas[name].Description.Should().Be(description); }
public void Given_Value_Property_Should_Return_Value(bool nullable, object @default, string description, bool deprecated) { var attribute = new OpenApiPropertyAttribute() { Nullable = nullable, Default = @default, Description = description, Deprecated = deprecated }; attribute.Nullable.Should().Be(nullable); attribute.Default.Should().Be(@default); attribute.Description.Should().Be(description); attribute.Deprecated.Should().Be(deprecated); }
public void Given_OpenApiPropertyAttribute_With_Default_When_Visit_Invoked_Then_It_Should_Return_Result(string name, bool nullable, string description) { var @default = FakeShortEnum.ShortValue1; var acceptor = new OpenApiSchemaAcceptor(); var type = new KeyValuePair <string, Type>(name, typeof(FakeShortEnum)); var attribute = new OpenApiPropertyAttribute() { Nullable = nullable, Default = @default, Description = description }; this._visitor.Visit(acceptor, type, this._strategy, attribute); acceptor.Schemas[name].Nullable.Should().Be(nullable); acceptor.Schemas[name].Default.Should().NotBeNull(); (acceptor.Schemas[name].Default as OpenApiInteger).Value.Should().Be((short)@default); acceptor.Schemas[name].Description.Should().Be(description); }