Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recurrence Custom Properties Not Parsed #1

Closed
bchavez opened this issue May 25, 2015 · 2 comments
Closed

Recurrence Custom Properties Not Parsed #1

bchavez opened this issue May 25, 2015 · 2 comments

Comments

@bchavez
Copy link
Contributor

bchavez commented May 25, 2015

Hi,

I'm really happy to see PDI open-sourced now. I bought a PDI license long-long ago.

So, I've migrated some legacy code to use the NuGet lib and have a couple of unit tests that are failing.

In particular, I noticed Recurrence.ToStringWithStartDateTime() includes custom properties into the recurrence rule. However, creating a new recurrence (from the original serialization) won't include the custom properties. For example, the following unit test fails:

var source = new Recurrence
    {
        StartDateTime = DateTime.Parse("1/1/2008 4:30 AM"),
        RecurUntil = DateTime.Parse("1/5/2008 5:30 AM")
    };
source.RecurDaily( 1 );

source.CustomProperties.Add("hello");

var ruleAsString = source.ToStringWithStartDateTime();
Console.WriteLine( ruleAsString );
//FREQ=DAILY;UNTIL=20080105T133000Z;hello;X-EWSOFTWARE-DTSTART=20080101T123000Z

var target = new Recurrence( ruleAsString );

target.CustomProperties.Count.Should().Be(1);
//Expected 1, but found 0.

I'd be happy to send you a pull request that fixes the issue. Thanks!

@bchavez bchavez changed the title Custom Properties Not Parsed Recurrence Custom Properties Not Parsed May 25, 2015
@EWSoftware
Copy link
Owner

Although not enforced when adding them, custom properties are expected to be in the form "X-NAME=Value" per the specification. Since a name alone without a value doesn't conform to what is being parsed, it does end up being ignored. It can be extended to support non-standard properties that are names alone so if you've got a patch, I can merge it.

@bchavez
Copy link
Contributor Author

bchavez commented May 25, 2015

Ah yes, thank you. The unit test is passing now with "X-NAME=Value". I should have looked more closely at the parsing method. Sorry I missed that. It's probably okay the way it is currently. Thanks Eric.

@bchavez bchavez closed this as completed May 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants