public void ShouldBeAbleToSaveAEntity() { var entityRepository = new EntityRepository(_session); var entity = new BusinessEntity { Name = "test" }; entityRepository.Save(entity); entity.Id.Should().NotBeEmpty(); }
public void SavingAnExistingEntityShouldNotChangeId() { var entity = new BusinessEntity { Name = "test" }; _session.Store(entity); _session.SaveChanges(); var entityRepository = new EntityRepository(_session); var entityGet = entityRepository.GetSingle<BusinessEntity>(x => x.Name == Entityname); entityRepository.Save(entityGet); entityGet.Id.Should().Be(entity.Id); }
public void ShouldBeAbleToGetAllEntitys() { var entity1 = new BusinessEntity { Name = "test" }; var entity2 = new BusinessEntity { Name = "test" }; _session.Store(entity1); _session.Store(entity2); _session.SaveChanges(); var entityRepository = new EntityRepository(_session); var entitys = entityRepository.GetAll<BusinessEntity>(); entitys.Count.Should().Be(2); }
public void ShouldBeAbleToRetrieveAEntity() { var entity = new BusinessEntity { Name = "test" }; _session.Store(entity); _session.SaveChanges(); var entityRepository = new EntityRepository(_session); var getEntity = entityRepository.GetSingle<BusinessEntity>(x => x.Name == Entityname); AssertAll.Succeed( () => Assert.IsNotNullOrEmpty(getEntity.Id, "Id should be retrieved"), () => Assert.IsNotNullOrEmpty(getEntity.Name, "Password should be retrieved") ); }