public void ShouldBuildThirdPartyAttributeExtensionWithExpiryDates(string expiryDateInputString, string expectedExpiryDate) { bool parseSuccess = DateTime.TryParse( expiryDateInputString, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal, out DateTime expiryDate); Assert.IsTrue(parseSuccess); Extension <ThirdPartyAttributeContent> extension = new ThirdPartyAttributeExtensionBuilder() .WithDefinition(_someDefinition) .WithExpiryDate(expiryDate) .Build(); Assert.AreEqual(expectedExpiryDate, extension.Content.ExpiryDate); }
public void ShouldBuildThirdPartyAttributeExtensionWithGivenValues() { Extension <ThirdPartyAttributeContent> extension = new ThirdPartyAttributeExtensionBuilder() .WithDefinition(_someDefinition) .WithExpiryDate(_someDate) .Build(); Assert.AreEqual(Constants.Extension.ThirdPartyAttribute, extension.ExtensionType); string expectedDate = _someDate.ToString(Constants.Format.RFC3339PatternMilli, CultureInfo.InvariantCulture); Assert.AreEqual(expectedDate, extension.Content.ExpiryDate); List <AttributeDefinition> definitions = extension.Content.Definitions; Assert.AreEqual(1, definitions.Count); Assert.AreEqual(_someDefinition, definitions[0].Name); }
public void ShouldBuildThirdPartyAttributeExtensionWithMultipleDefinitions() { var definitions = new List <string> { "firstDefinition", "secondDefinition" }; Extension <ThirdPartyAttributeContent> extension = new ThirdPartyAttributeExtensionBuilder() .WithDefinitions(definitions) .WithExpiryDate(_someDate) .Build(); Assert.AreEqual(Constants.Extension.ThirdPartyAttribute, extension.ExtensionType); List <AttributeDefinition> result = extension.Content.Definitions; Assert.AreEqual(2, result.Count); Assert.AreEqual("firstDefinition", result[0].Name); Assert.AreEqual("secondDefinition", result[1].Name); }