8000 Merge pull request #198 from notion-dotnet/feature/177-add-support-fo… · notion-dotnet/notion-sdk-net@139d68e · GitHub
[go: up one dir, main page]

Skip to content

Commit 139d68e

Browse files
Merge pull request #198 from notion-dotnet/feature/177-add-support-for-equation-block
Add support to update equation block ✨
2 parents 2ed2006 + 012f1bf commit 139d68e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class EquationUpdateBlock : UpdateBlock, IUpdateBlock
6+
{
7+
[JsonProperty("equation")]
8+
public Data Equation { get; set; }
9+
10+
public class Data
11+
{
12+
[JsonProperty("expression")]
13+
public string Expression { get; set; }
14+
}
15+
}
16+
}

Test/Notion.IntegrationTests/IBlocksClientTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,25 @@ private static IEnumerable<object[]> BlockData()
239239
Assert.Equal("https://github.com/notion-dotnet/notion-sdk-net", updatedBlock.Bookmark.Url);
240240
Assert.Equal("Github", updatedBlock.Bookmark.Caption.OfType<RichTextText>().First().Text.Content);
241241
})
242+
},
243+
new object[] {
244+
new EquationBlock
245+
{
246+
Equation = new EquationBlock.Info
247+
{
248+
Expression = "e=mc^3"
249+
}
250+
},
251+
new EquationUpdateBlock {
252+
Equation = new EquationUpdateBlock.Data
253+
{
254+
Expression = "e=mc^2"
255+
}
256+
},
257+
new Action<Block>((block) => {
258+
var updatedBlock = (EquationBlock)block;
259+
Assert.Equal("e=mc^2", updatedBlock.Equation.Expression);
260+
})
242261
}
243262
};
244263
}

0 commit comments

Comments
 (0)
0