コード例 #1
0
        public void TestDuplicate()
        {
            AclBuilder acl = new AclBuilder();

            acl.AddEmail(TestConstants.TestEmail);
            acl.AddUserId(TestConstants.TestUserId);
            acl.AddGroup(PredefinedGroup.AuthenticatedUsers);

            Assert.Throws <ArgumentException>(() => acl.AddEmail(TestConstants.TestEmail));
            Assert.Throws <ArgumentException>(() => acl.AddUserId(TestConstants.TestUserId));
            Assert.Throws <ArgumentException>(() => acl.AddGroup(PredefinedGroup.AuthenticatedUsers));
        }
コード例 #2
0
        public void GenericTest()
        {
            AclBuilder acl = new AclBuilder();

            Assert.Null(acl.Build());

            acl.AddEmail(TestConstants.TestEmail);
            acl.AddEmail("*****@*****.**");
            Assert.Equal($"emailAddress=\"{TestConstants.TestEmail}\",emailAddress=\"[email protected]\"", acl.Build());

            acl.AddUserId(TestConstants.TestUserId);
            Assert.Equal($"emailAddress=\"{TestConstants.TestEmail}\",emailAddress=\"[email protected]\",id=\"{TestConstants.TestUserId}\"", acl.Build());

            acl.AddGroup(PredefinedGroup.AllUsers);
            Assert.Equal($"emailAddress=\"{TestConstants.TestEmail}\",emailAddress=\"[email protected]\",id=\"{TestConstants.TestUserId}\",uri=\"http://acs.amazonaws.com/groups/global/AllUsers\"", acl.Build());
        }