public IEnumerable <WeatherForecast> Get() { var a = _app.Get(1).MapTo <RawDataVM>(); var rng = new Random(); return(Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }) .ToArray()); }
public void Get_Test() { var fixture = new Fixture().Customize(new AutoMoqCustomization()); var entity = fixture.Build <RawData>() .With(x => x.id, 1) .With(x => x.name, "abc") .Create(); var repoMock = fixture.Freeze <Mock <IRepository <RawData> > >(); repoMock.Setup(x => x.FindSingle(It.IsAny <Expression <Func <RawData, bool> > >())).Returns(entity); var unitMock = fixture.Freeze <Mock <UnitWork> >(); var host = new RawDataManager(unitMock.Object, repoMock.Object); var a = host.Get(1); Assert.Equal(a.id, 1); }