public void GetRequiredByCode_WhenExists_Returns(string definitionCode) { var entityDefinitions = GetBaseCustomEntityDefinitions(); var repo = new CustomEntityDefinitionRepository(entityDefinitions); var result = repo.GetByCode(definitionCode); result.CustomEntityDefinitionCode.Should().Be(definitionCode); }
public void GetAll_WhenEmpty_ReturnsNone() { var entityDefinitions = Enumerable.Empty <ICustomEntityDefinition>(); var repo = new CustomEntityDefinitionRepository(entityDefinitions); var result = repo.GetAll(); result.Should().BeEmpty(); }
public void GetRequiredByCode_WhenNotExists_Throws() { var entityDefinitions = GetBaseCustomEntityDefinitions(); var repo = new CustomEntityDefinitionRepository(entityDefinitions); repo.Invoking(r => r.GetRequiredByCode("UNIQUE")) .Should() .Throw <EntityNotFoundException <ICustomEntityDefinition> >(); }
public void GetByCode_WhenNotExists_ReturnsNull() { var entityDefinitions = GetBaseCustomEntityDefinitions(); var repo = new CustomEntityDefinitionRepository(entityDefinitions); var result = repo.GetByCode("UNIQUE"); result.Should().BeNull(); }
public void GetByCode_WhenExists_Returns(string definitionCode) { var entityDefinitions = GetBaseCustomEntityDefinitions(); var repo = new CustomEntityDefinitionRepository(entityDefinitions); var result = repo.GetByCode(definitionCode); Assert.Equal(definitionCode, result.CustomEntityDefinitionCode); }
public void GetAll_WhenNotEmpty_ReturnsAll() { var entityDefinitions = GetBaseCustomEntityDefinitions(); var total = entityDefinitions.Count; var repo = new CustomEntityDefinitionRepository(entityDefinitions); var result = repo.GetAll(); result.Should().HaveCount(total); }
public void GetAll_WhenNotEmpty_ReturnsAll() { var entityDefinitions = GetBaseCustomEntityDefinitions(); var total = entityDefinitions.Count; var repo = new CustomEntityDefinitionRepository(entityDefinitions); var result = repo.GetAll(); Assert.Equal(total, result.Count()); }