public void GetFeatureType_WhenFeatureNameIsWorkflow_FeatureTypeIsWorkflow()
        {
            // Arrange
            var featureInformation = new FeatureInformation(_workflowFeatureName, DateTime.UtcNow);
            // Act
            var featureType = featureInformation.GetFeatureType();

            // Assert
            Assert.AreEqual(FeatureTypes.Workflow, featureType);
        }
        public void GetStatus_WhenExpirationDateHasPassed_StatusIsExpired()
        {
            // Arrange
            var expirationDate     = DateTime.MinValue;
            var featureInformation = new FeatureInformation(_workflowFeatureName, expirationDate);
            // Act
            var status = featureInformation.GetStatus();

            // Assert
            Assert.AreEqual(FeatureLicenseStatus.Expired, status);
        }
        public void GetStatus_WhenExpirationDateIsUpcoming_StatusIsActive()
        {
            // Arrange
            var expirationDate     = DateTime.MaxValue;
            var featureInformation = new FeatureInformation(_workflowFeatureName, expirationDate);
            // Act
            var status = featureInformation.GetStatus();

            // Assert
            Assert.AreEqual(FeatureLicenseStatus.Active, status);
        }
        public void GetStatus_WhenExpirationDateIsEqual_StatusIsActive()
        {
            // Arrange
            var expirationDate = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            _timeProviderMock.Setup(i => i.CurrentUniversalTime).Returns(expirationDate);
            var featureInformation = new FeatureInformation(_workflowFeatureName, expirationDate, _timeProviderMock.Object);
            // Act
            var status = featureInformation.GetStatus();

            // Assert
            Assert.AreEqual(FeatureLicenseStatus.Active, status);
        }
        public void GetFeatureType_ReturnsNone_WhenFeatureNameIsInvalid()
        {
            var invalidFeatureNames = new[] { "invalid feature name", "Author", "Collaborate", "View", "None" };

            foreach (var name in invalidFeatureNames)
            {
                // Arrange
                var featureInformation = new FeatureInformation(name, DateTime.MaxValue);
                // Act
                var featureType = featureInformation.GetFeatureType();
                // Assert
                Assert.AreEqual(FeatureTypes.None, featureType);
            }
        }
        public void GetFeatureType_DoesNotReturnNone_WhenFeatureNameIsValid()
        {
            var validFeatureNames = FeatureInformation.Features.Where(f => f.Value != FeatureTypes.None).Select(f => f.Key);

            foreach (var name in validFeatureNames)
            {
                // Arrange
                var featureInformation = new FeatureInformation(name, DateTime.MaxValue);
                // Act
                var featureType = featureInformation.GetFeatureType();
                // Assert
                Assert.AreNotEqual(FeatureTypes.None, featureType);
            }
        }