public void CanGetASynonymWordEntity() { var synonymWord = EntityHelpers.CreateSynonymWord(); DatabaseContext.Add(synonymWord); DatabaseContext.SaveChanges(); //var result = DatabaseContext.SynonymWords.ToList().FirstOrDefault(); var result = DatabaseContext.SynonymWords.FirstOrDefault(x => x.Id == synonymWord.Id); result.Should().BeEquivalentTo(synonymWord); }
public void GivenAnIdAMatchingSynonymWordGetsDeleted() { var synonymWord = EntityHelpers.CreateSynonymWord(); DatabaseContext.Add(synonymWord); DatabaseContext.SaveChanges(); _classUnderTest.DeleteSynonymWord(synonymWord.Id); var expectedResult = DatabaseContext.SynonymWords.Find(synonymWord.Id); expectedResult.Should().BeNull(); }
public void GivenSynonymWordDomainObjectSynonymWordGetsCreated() { var synonymWord = EntityHelpers.CreateSynonymWord(); var gatewayResult = _classUnderTest.CreateSynonymWord(synonymWord); var expectedResult = DatabaseContext.SynonymWords.Where(x => x.Word == synonymWord.Word).FirstOrDefault(); gatewayResult.Should().NotBeNull(); gatewayResult.Should().BeEquivalentTo(expectedResult, options => { return(options); }); }
public void GivenAnIdAMatchingSynonymWordGetsReturned() { var synonymWord = EntityHelpers.CreateSynonymWord(); DatabaseContext.Add(synonymWord); DatabaseContext.SaveChanges(); var gatewayResult = _classUnderTest.GetSynonymWord(synonymWord.Id); var expectedResult = DatabaseContext.SynonymWords.Find(synonymWord.Id); gatewayResult.Should().NotBeNull(); gatewayResult.Should().BeEquivalentTo(expectedResult, options => { return(options); }); }
public void GivenAnSynonymWordAMatchingSynonymWordGetsUpdated() { var synonymWord = EntityHelpers.CreateSynonymWord(); DatabaseContext.Add(synonymWord); DatabaseContext.SaveChanges(); var synonymWordDomain = _mapper.ToDomain(synonymWord); synonymWordDomain.Word = Randomm.Text(); _classUnderTest.PatchSynonymWord(synonymWordDomain); var expectedResult = DatabaseContext.SynonymWords.Find(synonymWord.Id); expectedResult.Should().BeEquivalentTo(synonymWordDomain, options => { return(options); }); }
public void GivenSearchParametersMatchingSynonymWordsGetReturned() { var synonymWord = EntityHelpers.CreateSynonymWord(); DatabaseContext.AddRange(synonymWord); DatabaseContext.SaveChanges(); var searchParams = new SynonymWordSearchRequest(); var sgToFind = synonymWord; searchParams.Search = sgToFind.Word; searchParams.Sort = "Word"; searchParams.Direction = SortDirection.Asc.ToString(); var gatewayResult = _classUnderTest.SearchSynonymWords(searchParams); gatewayResult.Should().NotBeNull(); gatewayResult.First().Should().BeEquivalentTo(sgToFind, options => { options.Excluding(ex => ex.Group); return(options); }); }