public void Serialize()
        {
            // Assign
            var serializer = new JsonFeatureToggleSerializer();
            var condition  = Allow.Simple()
                             .Or(Allow.FromDateTime(new DateTime(2019, 05, 16, 15, 0, 0, DateTimeKind.Utc))
                                 .And(Allow.UntilDateTime(new DateTime(2019, 05, 17, 15, 0, 0, DateTimeKind.Utc)))
                                 .And(Restrict.DayOfWeek(DayOfWeek.Wednesday))
                                 .And(Restrict.Installation("SAMPLE_INSTALLATION#2"))
                                 .And(Restrict.User("USER#2"))
                                 .And(Allow.DaysOfWeek(DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday))
                                 .And(Allow.Installation("SAMPLE_INSTALLATION#1"))
                                 .And(Allow.User("USER#1"))
                                 .And(Restrict.Simple())
                                 .And(Allow.FromTimeOfDay(new TimeSpan(15, 0, 0)))
                                 .And(Allow.UntilTimeOfDay(new TimeSpan(16, 0, 0)))
                                 );
            var featureToggle = new FeatureToggle();

            featureToggle.FeatureName = "MyFeature";
            featureToggle.Condition   = condition;

            // Act
            var serialized = serializer.Serialize(featureToggle);

            // Assert
            // Assert correctly. Don't read the expected from the static variable but from a static file
        }
        public void ConstructorShouldThrowExceptionWhenRightOperandIsNull()
        {
            // Arrange

            // Act

            // Assert
            Assert.Throws <ArgumentNullException>(() => new OrCondition(Allow.Simple(), null));
        }
        public void ConstructorShouldThrowExceptionWhenLeftOperandIsNull()
        {
            // Arrange

            // Act

            // Assert
            Assert.Throws <ArgumentNullException>(() => new AndCondition(null, Allow.Simple()));
        }
        public void ConditionHoldsShouldReturnTrueWhenRightOperandIsTrue()
        {
            // Arrange
            var condition = Restrict.Simple().Or(Allow.Simple());
            var context   = new Context(null, null, null);

            // Act
            var conditionHolds = condition.Holds(context);

            // Assert
            Assert.True(conditionHolds);
        }
        public void ConditionHoldsShouldReturnFalseWhenRightOperandIsFalse()
        {
            // Arrange
            var condition = Allow.Simple().And(Restrict.Simple());
            var context   = new Context(null, null, null);

            // Act
            var conditionHolds = condition.Holds(context);

            // Assert
            Assert.False(conditionHolds);
        }
        public void ConditionHoldsShouldReturnTrueWhenBothOperandsAreTrue()
        {
            // Arrange
            var condition = Allow.Simple().And(Allow.Simple());
            var context   = new Context(null, null, null);

            // Act
            var conditionHolds = condition.Holds(context);

            // Assert
            Assert.True(conditionHolds);
        }