public void GetDifferenceBetweenDates_returnsValueFromProcessor() { //Arrange Mock <ITimeframeProcessor> mockProcessor = new Mock <ITimeframeProcessor>(); mockProcessor.Setup(p => p.CountTimeUnits(It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <int>())).Returns(10); Timeframe timeframe = defaultTimeframe(); timeframe.InjectTimeframeProcessor(mockProcessor.Object); //Act. int difference = timeframe.GetDifferenceBetweenDates(new DateTime(), new DateTime()); //Assert. Assert.AreEqual(10, difference); }
public void GetProperDateTime_returnsValueFromProcessor() { //Arrange Mock <ITimeframeProcessor> mockProcessor = new Mock <ITimeframeProcessor>(); DateTime expectedDateTime = new DateTime(); mockProcessor.Setup(p => p.GetProperDateTime(It.IsAny <DateTime>(), It.IsAny <int>())).Returns(expectedDateTime); Timeframe timeframe = defaultTimeframe(); timeframe.InjectTimeframeProcessor(mockProcessor.Object); //Act. DateTime datetime = timeframe.GetProperDateTime(new DateTime()); //Assert. Assert.AreEqual(expectedDateTime, datetime); }