public void PassesWhen_EndTimePropertyIsValidType()
        {
            //arrange
            var expectedException = default(ArgumentException);
            var startTimeProperty = new Mock<IPropertyInfo>();
            startTimeProperty.Setup(s => s.Name).Returns("StartTime");
            startTimeProperty.Setup(s => s.Type).Returns(typeof(DateTime));

            var endTimeProperty = new Mock<IPropertyInfo>();
            endTimeProperty.Setup(s => s.Name).Returns("endTime");
            endTimeProperty.Setup(s => s.Type).Returns(typeof(DateTime));
            //act
            var innerRule1 = new TopOfTheHourRule(startTimeProperty.Object);
            var innerRule2 = new TopOfTheHourRule(endTimeProperty.Object);
            var newRule = new TimeRangeRule(startTimeProperty.Object, endTimeProperty.Object, innerRule1, innerRule2);

            //assert
            Assert.IsNotNull(newRule);
        }
        public void PassesWhen_StartTimeIsBeforeEndTime()
        {
            //arrange
            var startTimeProperty = new Mock<IPropertyInfo>();
            startTimeProperty.Setup(s => s.Name).Returns("StartTime");
            startTimeProperty.Setup(s => s.Type).Returns(typeof(DateTime));

            var endTimeProperty = new Mock<IPropertyInfo>();
            endTimeProperty.Setup(s => s.Name).Returns("EndTime");
            endTimeProperty.Setup(s => s.Type).Returns(typeof(DateTime));


            var wsMock = new Mock<IWorkSchedule>();
            wsMock.SetupProperty<DateTime>(ws => ws.StartTime, new DateTime(2014,4,1,10,0,0));
            wsMock.SetupProperty<DateTime>(ws => ws.EndTime, new DateTime(2014, 4, 1, 11, 0, 0));

            var innerRule1 = new TopOfTheHourRule(startTimeProperty.Object);
            var innerRule2 = new TopOfTheHourRule(endTimeProperty.Object);
            var newRule = new TimeRangeRule(startTimeProperty.Object, endTimeProperty.Object, innerRule1, innerRule2);
            var ruleContext = new RuleContext(null, newRule, wsMock.Object, new Dictionary<IPropertyInfo, object>() { { startTimeProperty.Object, wsMock.Object.StartTime }, {endTimeProperty.Object, wsMock.Object.EndTime} });
            var ruleInterface = (IBusinessRule)newRule;

            //act
            ruleInterface.Execute(ruleContext);

            //assert

            Assert.IsNull(ruleContext.Results.SingleOrDefault(_ => _.Description == ValidationMessages.InvalidTimeRange));

           
        }
        public void PassesWhen_EndTimePropertyIsSupplied()
        {
            //arrange

            var startTimeProperty = new Mock<IPropertyInfo>();
            startTimeProperty.Setup(s => s.Name).Returns("StartTime");
            startTimeProperty.Setup(s => s.Type).Returns(typeof(DateTime));

            var endTimeProperty = new Mock<IPropertyInfo>();
            endTimeProperty.Setup(s => s.Name).Returns("endTime");
            endTimeProperty.Setup(s => s.Type).Returns(typeof(DateTime));

            //act
            var innerRule1 = new TopOfTheHourRule(startTimeProperty.Object);
            var innerRule2 = new TopOfTheHourRule(endTimeProperty.Object);
            var newRule = new TimeRangeRule(startTimeProperty.Object, endTimeProperty.Object, innerRule1, innerRule2);

            //asset
            Assert.IsNotNull(newRule);
        }