public void Should_Delete_Layer_In_Db() { var fakeContext = new FakeContext("DeleteLayer"); fakeContext.FillWith <Layer>(); using (var context = new MainContext(fakeContext.FakeOptions)) { var repository = new LayerRepository(context); var currentCount = context.Layer.Count(); var newLayer = new Layer(); newLayer.Name = "Layer"; repository.Create(newLayer); var idToDelete = (from l in repository.GetAll() where l.Id == newLayer.Id select l.Id).FirstOrDefault(); Assert.Equal(currentCount + 1, repository.GetAll().Count()); repository.Delete(idToDelete); Assert.Equal(currentCount, context.Layer.Count()); repository.Dispose(); } }
public void Should_Return_All_Layer_In_Db() { var fakeContext = new FakeContext("GetAllLayer"); fakeContext.FillWith <Layer>(); using (var context = new MainContext(fakeContext.FakeOptions)) { var layerCountIndDb = context.Layer.Count(); var repository = new LayerRepository(context); Assert.Equal(layerCountIndDb, repository.GetAll().Count()); repository.Dispose(); } }