Exemple #1
0
        public void ShouldFormatSingleRole_AsExpected()
        {
            var sut = new YamlRoleSerializationFormatter();

            using (var ms = new MemoryStream())
            {
                sut.WriteSerializedRole(new SerializedRoleData("Test", new string[0], "Foo"), ms);

                ms.Seek(0, SeekOrigin.Begin);

                using (var reader = new StreamReader(ms))
                {
                    var yml = reader.ReadToEnd();

                    yml.Should().Be(@"---
Role: Test
");
                }
            }
        }
Exemple #2
0
        public void ShouldFormatRoleWithParents_AsExpected()
        {
            var sut = new YamlRoleSerializationFormatter();

            using (var ms = new MemoryStream())
            {
                sut.WriteSerializedRole(new SerializedRoleData("Test", new [] { "Foo", "Foo-Bar" }, "Foo"), ms);

                ms.Seek(0, SeekOrigin.Begin);

                using (var reader = new StreamReader(ms))
                {
                    var yml = reader.ReadToEnd();

                    yml.Should().Be(@"---
Role: Test
MemberOf:
  Role: Foo
  Role: ""Foo-Bar""
");
                }
            }
        }