public void Should_Update_Layer_In_Db(int id)
        {
            var fakeContext = new FakeContext("UpdateLayer");

            fakeContext.FillWith <Layer>();

            using (var context = new MainContext(fakeContext.FakeOptions))
            {
                var repository   = new LayerRepository(context);
                var currentLayer = repository.GetById(id);

                currentLayer.Name = "123abc";
                repository.Update(currentLayer);
                Assert.Equal("123abc", repository.GetById(id).Name);
                repository.Dispose();
            }
        }
        public void Should_Return_Right_Layer_When_Find_By_Id_In_Db(int id)
        {
            var fakeContext = new FakeContext("LayerById");

            fakeContext.FillWith <Layer>();

            using (var context = new MainContext(fakeContext.FakeOptions))
            {
                var expected   = fakeContext.GetFakeData <Layer>().Find(x => x.Id == id);
                var repository = new LayerRepository(context);
                var actual     = repository.GetById(id);

                Assert.Equal(expected, actual, new LayerIdComparer());
                repository.Dispose();
            }
        }
        public void Should_Save_New_Layer_To_Db()
        {
            var fakeContext = new FakeContext("AddNewLayer");

            var fakeLayer = new Layer();

            fakeLayer.Name = "Desenvolvimento";
            fakeLayer.Id   = 4;

            using (var context = new MainContext(fakeContext.FakeOptions))
            {
                var repository = new LayerRepository(context);
                repository.Create(fakeLayer);

                var createdLayer = repository.GetById(4);

                Assert.NotEqual(0, fakeLayer.Id);
                Assert.Equal("Desenvolvimento", createdLayer.Name);
                Assert.Equal(4, createdLayer.Id);
                repository.Dispose();
            }
        }