Exemplo n.º 1
0
        public void AuthToken_WithExpiresOn_Should_Throw_Exception_When_Invalid()
        {
            var authToken = new AccountApi.Domain.AuthToken("test");

            authToken.WithCreatedOn(DateTime.UtcNow);
            Func <AccountApi.Domain.AuthToken> func = () => authToken.WithExpiresOn(DateTime.UtcNow.AddDays(-1));

            func.Should().Throw <ArgumentException>();
        }
Exemplo n.º 2
0
        public void AuthToken_WithCreateOn_WithExpiresOn_Should_Assign_Dates_When_Valid()
        {
            var authToken = new AccountApi.Domain.AuthToken("test");

            authToken.WithCreatedOn(DateTime.UtcNow);
            authToken.CreatedOn.TimeOfDay.Should().BeLessThan(DateTime.UtcNow.TimeOfDay);
            authToken.WithExpiresOn(DateTime.UtcNow.AddDays(1));
            authToken.CreatedOn.TimeOfDay.Should().BeLessThan(DateTime.UtcNow.TimeOfDay);
            authToken.ExpiresOn.TimeOfDay.Should().BeLessThan(DateTime.UtcNow.TimeOfDay);
        }