public void BySymbol_returnsExistingInstance() { //Arrange Mock <ITimeframeService> mockService = new Mock <ITimeframeService>(); Timeframe expectedTimeframe = new Timeframe(DEFAULT_ID, DEFAULT_NAME, DEFAULT_UNIT_TYPE, DEFAULT_UNITS_COUNTER); mockService.Setup(s => s.GetTimeframeByName(DEFAULT_NAME)).Returns(expectedTimeframe); Timeframe.injectService(mockService.Object); //Act. Timeframe timeframe = Timeframe.ByName(DEFAULT_NAME); //Assert. Assert.AreSame(expectedTimeframe, timeframe); }