diff --git a/VkNet.Tests/Enum/StringEnums/StringEnumTests.cs b/VkNet.Tests/Enum/StringEnums/StringEnumTests.cs index 8f2469099..598295b23 100644 --- a/VkNet.Tests/Enum/StringEnums/StringEnumTests.cs +++ b/VkNet.Tests/Enum/StringEnums/StringEnumTests.cs @@ -684,6 +684,10 @@ public void PhotoSizeTypeTest() Utilities.Deserialize("e") .Should() .Be(PhotoSizeType.E); + + Utilities.Deserialize("j") + .Should() + .Be(PhotoSizeType.J); } [Fact] diff --git a/VkNet.Tests/Models/MarketModel.cs b/VkNet.Tests/Models/MarketModel.cs new file mode 100644 index 000000000..58ae72c3f --- /dev/null +++ b/VkNet.Tests/Models/MarketModel.cs @@ -0,0 +1,24 @@ +using FluentAssertions; +using VkNet.Model; +using Xunit; + +namespace VkNet.Tests.Models; + +public class MarketModel +{ + [Fact] + public void ToString_MarketShouldHaveIdAndAccessKey() + { + var market = new Market + { + Id = 1234, + OwnerId = 1234, + AccessKey = "test" + }; + + var result = market.ToString(); + + result.Should() + .Be("market1234_1234_test"); + } +} \ No newline at end of file diff --git a/VkNet/Enums/StringEnums/PhotoSizeType.cs b/VkNet/Enums/StringEnums/PhotoSizeType.cs index 31576ca25..cf95ef737 100644 --- a/VkNet/Enums/StringEnums/PhotoSizeType.cs +++ b/VkNet/Enums/StringEnums/PhotoSizeType.cs @@ -151,5 +151,13 @@ public enum PhotoSizeType /// /// Документация /// - L + L, + + /// + /// В документации отсутствует описание + /// + /// + /// Документация + /// + J } \ No newline at end of file diff --git a/VkNet/Model/Attachments/Market.cs b/VkNet/Model/Attachments/Market.cs index 1be6bad6b..8c07d3827 100644 --- a/VkNet/Model/Attachments/Market.cs +++ b/VkNet/Model/Attachments/Market.cs @@ -27,12 +27,7 @@ public class Market : MediaAttachment { get => _id; - set { - if (value is null) - { - _id ??= -1; - } - } + set => _id = value ?? -1; } /// @@ -120,4 +115,19 @@ public class Market : MediaAttachment [JsonProperty("button_title")] [JsonConverter(typeof(SafetyEnumJsonConverter))] public MarketItemButtonTitle ButtonTitle { get; set; } + + /// + /// Преобразовать вложение в строку. + /// + /// + /// Строковое представление + /// + public override string ToString() + { + var result = $"{Alias}{OwnerId}_{Id}"; + + return string.IsNullOrWhiteSpace(AccessKey) + ? result + : $"{result}_{AccessKey}"; + } } \ No newline at end of file