public void PropertyValuesIsValid() { // Arrange. const string attributeTypeDescription = "description"; object[] attributeValuesDescription = { "Contractor" }; ModSpec modSpecDescription = new ModSpec(ModSpecType.Add, attributeTypeDescription, attributeValuesDescription); const string attributeTypeTelephoneNumber = "telephonenumber"; object[] attributeValuesTelephoneNumber = { "+1 (415) 555 1234" }; ModSpec modSpecTelephoneNumber = new ModSpec(ModSpecType.Replace, attributeTypeTelephoneNumber, attributeValuesTelephoneNumber); // Act. ChangeModify sut = new ChangeModify(DistinguishedName, new[] { modSpecDescription, modSpecTelephoneNumber }); ModSpec sutModSpecDescription = sut.ModSpecs.First(x => x.AttributeType.Equals(attributeTypeDescription)); ModSpec sutModSpecTelephoneNumber = sut.ModSpecs.First(x => x.AttributeType.Equals(attributeTypeTelephoneNumber)); // Assert. Assert.Equal(2, sut.ModSpecs.ToArray().Length); Assert.Equal(attributeTypeDescription, sutModSpecDescription.AttributeType); Assert.Equal(attributeValuesDescription, sutModSpecDescription.AttributeValues); Assert.Equal(attributeTypeTelephoneNumber, sutModSpecTelephoneNumber.AttributeType); Assert.Equal(attributeValuesTelephoneNumber, sutModSpecTelephoneNumber.AttributeValues); }
public void PropertyDistinguishedNameIsValid() { // Act. ChangeModify sut = new ChangeModify(DistinguishedName, ModSpecs); // Arrange. Assert.Equal(DistinguishedName, sut.DistinguishedName); }
public void PropertyCountIsValid() { // Act. ChangeModify sut = new ChangeModify( DistinguishedName, new[] { new ModSpec(ModSpecType.Add, "description", new object[] { "Contractor" }), new ModSpec(ModSpecType.Replace, "telephonenumber", new object[] { "+1 (415) 555 1234" }) }); // Arrange. Assert.Equal(2, sut.Count); }
public void ShouldReplaceAllValues() { // Arrange. ModSpec[] modSpec = { new ModSpec(ModSpecType.Replace, "telephonenumber", null) }; string dump = string.Join( Environment.NewLine, "dn: CN=Leonardo Pisano Bigollo,OU=users,DC=company,DC=com", "changetype: modify", "replace: telephonenumber", "-", string.Empty); // Act. ChangeModify sut = new ChangeModify(DistinguishedName, modSpec); // Assert. Assert.Equal(dump, sut.Dump()); }
public void ShouldDeleteSingleValues() { // Arrange. ModSpec[] modSpec = { new ModSpec(ModSpecType.Delete, "description", new object[] { "Contractor" }) }; string dump = string.Join( Environment.NewLine, "dn: CN=Leonardo Pisano Bigollo,OU=users,DC=company,DC=com", "changetype: modify", "delete: description", "description: Contractor", "-", string.Empty); // Act. ChangeModify sut = new ChangeModify(DistinguishedName, modSpec); // Assert. Assert.Equal(dump, sut.Dump()); }
public void ShouldAddOneValue() { // Arrange. ModSpec[] modSpec = { new ModSpec(ModSpecType.Add, "postaladdress", new object[] { "2400 Fulton St, San Francisco, CA 94118, USA" }) }; string dump = string.Join( Environment.NewLine, "dn: CN=Leonardo Pisano Bigollo,OU=users,DC=company,DC=com", "changetype: modify", "add: postaladdress", "postaladdress: 2400 Fulton St, San Francisco, CA 94118, USA", "-", string.Empty); // Act. ChangeModify sut = new ChangeModify(DistinguishedName, modSpec); // Assert. Assert.Equal(dump, sut.Dump()); }