Skip to content

Add NotBeIn in DateTimeAssertions  #2434

@Meir017

Description

@Meir017

Background and motivation

I noticed while working on #2433 that we cannot convert actual.Kind.Should().NotBe(unexpected.Kind); to use a date-time specific assertion

Matching negative assertion for DateTimeAssertions.BeIn

API Proposal

public class DateTimeAssertions
{
    public AndConstraint<TAssertions> NotBeIn(DateTimeKind unexpectedKind, string because = "", params object[] becauseArgs);
}

API Usage

var actual = new DateTime(2017, 1, 1, 16, 30, 17, 123, DateTimeKind.Utc);
var unexpected = new DateTime(2018, 2, 2, 19, 31, 18, 256, DateTimeKind.Local);

actual.Should().NotBeIn(unexpected.Kind);

Alternative Designs

No response

Risks

No response

Are you willing to help with a proof-of-concept (as PR in that or a separate repo) first and as pull-request later on?

Yes, please assign this issue to me.

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved, it can be implemented

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions