public void CanGetASynonymGroupEntity() { var synonymGroup = EntityHelpers.CreateSynonymGroup(); DatabaseContext.Add(synonymGroup); DatabaseContext.SaveChanges(); var result = DatabaseContext.SynonymGroups.FirstOrDefault(x => x.Id == synonymGroup.Id); result.Should().BeEquivalentTo(synonymGroup); }
public void GivenAnIdAMatchingSynonymGroupGetsDeleted() { var synonymGroup = EntityHelpers.CreateSynonymGroup(); DatabaseContext.Add(synonymGroup); DatabaseContext.SaveChanges(); _classUnderTest.DeleteSynonymGroup(synonymGroup.Id); var expectedResult = DatabaseContext.SynonymGroups.Find(synonymGroup.Id); expectedResult.Should().BeNull(); }
public void GivenSynonymGroupDomainObjectSynonymGroupGetsCreated() { var synonymGroup = EntityHelpers.CreateSynonymGroup(); var gatewayResult = _classUnderTest.CreateSynonymGroup(synonymGroup); var expectedResult = DatabaseContext.SynonymGroups.Where(x => x.Name == synonymGroup.Name).FirstOrDefault(); gatewayResult.Should().NotBeNull(); gatewayResult.Should().BeEquivalentTo(expectedResult, options => { options.Excluding(ex => ex.SynonymWords); return(options); }); }
public void GivenAnIdAMatchingSynonymGroupGetsReturned() { var synonymGroup = EntityHelpers.CreateSynonymGroup(); DatabaseContext.Add(synonymGroup); DatabaseContext.SaveChanges(); var gatewayResult = _classUnderTest.GetSynonymGroup(synonymGroup.Id); var expectedResult = DatabaseContext.SynonymGroups.Find(synonymGroup.Id); gatewayResult.Should().NotBeNull(); gatewayResult.Should().BeEquivalentTo(expectedResult, options => { options.Excluding(ex => ex.SynonymWords); return(options); }); }
public void GivenAnSynonymGroupAMatchingSynonymGroupGetsUpdated() { var synonymGroup = EntityHelpers.CreateSynonymGroup(); DatabaseContext.Add(synonymGroup); DatabaseContext.SaveChanges(); var synonymGroupDomain = _mapper.ToDomain(synonymGroup); synonymGroupDomain.Name = Randomm.Text(); _classUnderTest.PatchSynonymGroup(synonymGroupDomain); var expectedResult = DatabaseContext.SynonymGroups.Find(synonymGroup.Id); expectedResult.Should().BeEquivalentTo(synonymGroupDomain, options => { options.Excluding(ex => ex.SynonymWords); return(options); }); }
public void GivenSearchParametersMatchingSynonymGroupsGetReturned() { var synonymGroup = EntityHelpers.CreateSynonymGroup(); DatabaseContext.AddRange(synonymGroup); DatabaseContext.SaveChanges(); var searchParams = new SynonymGroupSearchRequest(); var sgToFind = synonymGroup; searchParams.Search = sgToFind.Name; searchParams.Sort = "Name"; searchParams.Direction = SortDirection.Asc.ToString(); var gatewayResult = _classUnderTest.SearchSynonymGroups(searchParams); gatewayResult.Should().NotBeNull(); gatewayResult.First().Should().BeEquivalentTo(sgToFind, options => { options.Excluding(ex => ex.SynonymWords); return(options); }); }