diff --git a/test/unit/ACLProcessorTest.cs b/test/unit/ACLProcessorTest.cs index f65880f8..843968f0 100644 --- a/test/unit/ACLProcessorTest.cs +++ b/test/unit/ACLProcessorTest.cs @@ -251,6 +251,10 @@ public async Task ACLProcessor_ProcessACL_Yields_Owns_ACE() mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); + var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor); var result = await processor.ProcessACL(bytes, _testDomainName, Label.User, false).ToArrayAsync(); @@ -394,6 +398,9 @@ public async Task ACLProcessor_ProcessACL_GenericAll_Unmatched_Guid() mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true,new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor); @@ -425,6 +432,9 @@ public async Task ACLProcessor_ProcessACL_GenericAll() mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor); @@ -462,6 +472,9 @@ public async Task ACLProcessor_ProcessACL_WriteDacl() mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor); @@ -499,6 +512,9 @@ public async Task ACLProcessor_ProcessACL_WriteOwner() mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor); @@ -536,6 +552,9 @@ public async Task ACLProcessor_ProcessACL_Self() mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(AddMemberSecurityDescriptor); @@ -572,6 +591,9 @@ public async Task ACLProcessor_ProcessACL_ExtendedRight_Domain_Unmatched() mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor); @@ -678,6 +700,9 @@ public async Task ACLProcessor_ProcessACL_ExtendedRight_Domain_DSReplicationGetC mockLDAPUtils.Setup(x => x.MakeSecurityDescriptor()).Returns(mockSecurityDescriptor.Object); mockLDAPUtils.Setup(x => x.ResolveIDAndType(It.IsAny(), It.IsAny())) .ReturnsAsync((true, new TypedPrincipal(expectedPrincipalSID, expectedPrincipalType))); + var mockData = new[] { LdapResult.Fail() }; + mockLDAPUtils.Setup(x => x.Query(It.IsAny(), It.IsAny())) + .Returns(mockData.ToAsyncEnumerable()); var processor = new ACLProcessor(mockLDAPUtils.Object); var bytes = Helpers.B64ToBytes(UnProtectedUserNtSecurityDescriptor);