From ef56f6b55c4728b425f8926efbd4db7e1c68daae Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Mon, 26 Mar 2018 19:08:03 -0700 Subject: [PATCH] Add general tests for the ChannelPermissions.Modify method to test default values --- .../Tests.ChannelPermissions.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/Discord.Net.Tests/Tests.ChannelPermissions.cs b/test/Discord.Net.Tests/Tests.ChannelPermissions.cs index b37a1195e..8514ad1a0 100644 --- a/test/Discord.Net.Tests/Tests.ChannelPermissions.cs +++ b/test/Discord.Net.Tests/Tests.ChannelPermissions.cs @@ -22,6 +22,27 @@ namespace Discord var copy = perm.Modify(); Assert.Equal((ulong)0, copy.RawValue); + // test modify with no parameters after using all + copy = ChannelPermissions.Text; + var modified = copy.Modify(); // no params should not change the result + Assert.Equal((ulong)ChannelPermissions.Text.RawValue, modified.RawValue); + + copy = ChannelPermissions.Voice; + modified = copy.Modify(); // no params should not change the result + Assert.Equal((ulong)ChannelPermissions.Voice.RawValue, modified.RawValue); + + copy = ChannelPermissions.Group; + modified = copy.Modify(); // no params should not change the result + Assert.Equal((ulong)ChannelPermissions.Group.RawValue, modified.RawValue); + + copy = ChannelPermissions.DM; + modified = copy.Modify(); // no params should not change the result + Assert.Equal((ulong)ChannelPermissions.DM.RawValue, modified.RawValue); + + copy = new ChannelPermissions(useExternalEmojis: true); + modified = copy.Modify(); + Assert.Equal(copy.RawValue, modified.RawValue); + // test the values that are returned by ChannelPermission.All Assert.Equal((ulong)0, ChannelPermissions.None.RawValue);