-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathBlockFixtures.cs
More file actions
38 lines (35 loc) · 1.35 KB
/
BlockFixtures.cs
File metadata and controls
38 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections.Generic;
using FluentAssertions;
using Newtonsoft.Json;
using Slack.Webhooks.Api;
using Slack.Webhooks.Blocks;
using Xunit;
namespace Slack.Webhooks.Tests
{
public class BlockFixtures
{
[Theory]
[MemberData(nameof(GetData))]
public void ShouldHaveBlockTypeAndBlockId(Block block, string expectedType, string expectedBlockId)
{
// arrange/act
var payload = ApiBase.SerializeObject(block);
// assert
payload.Should().Contain($"\"type\":\"{expectedType}\"");
payload.Should().Contain($"\"block_id\":\"{expectedBlockId}\"");
}
public static IEnumerable<object[]> GetData()
{
return new List<object[]>
{
new object[] { new Divider {BlockId = "0001"}, "divider", "0001" },
new object[] { new Image {BlockId = "0002"}, "image", "0002" },
new object[] { new Section {BlockId = "0003"}, "section", "0003" },
new object[] { new Context {BlockId = "0004"}, "context", "0004" },
new object[] { new File {BlockId = "0005"}, "file", "0005" },
new object[] { new Actions {BlockId = "0006"}, "actions", "0006" },
new object[] { new Input {BlockId = "0007"}, "input", "0007" }
};
}
}
}