public async Task ItShouldGetModelFromCache() { var cachedModel = new ModelMock(); var metaService = new MetaService( new MetaRepositoryMock(), new ModelLoaderMock(), new ModelCacheMock(cachedModel) ); var result = await metaService.GetModel(cachedModel.Name, CancellationToken.None); result.Should().BeSameAs(cachedModel); }
public async Task ItShouldLoadModelIfNotFromCache() { var model = new ModelMock(); var metaService = new MetaService( new MetaRepositoryMock(new PropertyBag()), new ModelLoaderMock(model), new ModelCacheMock(putAsserts: m => { m.Should().BeSameAs(model); }) ); var result = await metaService.GetModel(model.Name, CancellationToken.None); result.Should().BeSameAs(model); }
public async void TestUpdate500() { var guid = Guid.NewGuid(); var modelMock = new ModelMock() { Id = guid }; _service.Setup(s => s.UpdateAsync(modelMock)).Throws(new Exception()); var response = await _controller.Update(modelMock.Id.ToString(), modelMock); Assert.Equal(500, response.StatusCode); }
public async void TestCreate() { var guid = Guid.NewGuid(); var modelMock = new ModelMock() { Id = guid }; _service.Setup(s => s.AddAsync(modelMock)).Returns(Task.FromResult(modelMock)); var response = await _controller.Create(modelMock); Assert.Equal(201, response.StatusCode); Assert.Equal(modelMock, response.Value); }
public async void TestFind() { var guid = Guid.NewGuid(); var id = guid.ToString(); var modelMock = new ModelMock() { Id = guid }; _service.Setup(s => s.FindAsync(id)).Returns(Task.FromResult(modelMock)); var response = await _controller.Find(id); Assert.Equal(200, response.StatusCode); Assert.Equal(modelMock, response.Value); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Simulacion simu = new Simulacion(); simu.Nombre = "Test Simulacion"; simu.Duracion = 30; ModelMock mo = new ModelMock(); mo.MockResultados(); simu.TrazaSimulada = mo.Traza; ReportGraphsForm frm = new ReportGraphsForm(new SimulacionesListForm(), simu); frm.ShowDialog(); }
public void Init() { _modelMock = new ModelMock(); }