public void DeleteThreadFromDatabase() { var pattern = UnderTest.Model; UpdatePattern(pattern); var expectedThread = new { Length = 2, ThreadReferenceId = 1 }; var thread = new PatternThread { Length = expectedThread.Length, ThreadReferenceId = expectedThread.ThreadReferenceId }; pattern.Threads = thread.AsList(); UnderTest.SaveCommand.Execute(null); HasEntries <Pattern>(1); HasEntries <ThreadBase>(1); //var dbPattern = _patternRepository.Get(pattern.PatternId); //UnderTest.Initialise(dbPattern); UnderTest.DeleteThreadCommand.Execute(thread); UnderTest.SaveCommand.Execute(null); HasEntries <Pattern>(1); HasEntries <ThreadBase>(0); }
public void SavingNewPatternWithThread() { var pattern = UnderTest.Model; UpdatePattern(pattern); var expectedThread = new { Length = 2, ThreadReferenceId = 1 }; var thread = new PatternThread { Length = expectedThread.Length, ThreadReferenceId = expectedThread.ThreadReferenceId }; pattern.Threads = thread.AsList(); UnderTest.SaveCommand.Execute(null); // And the pattern isnt saved var dbPattern = _patternRepository.GetAll().Last(); dbPattern.Should().BeEquivalentTo(pattern, opt => opt.Excluding(o => o.Threads)); dbPattern.Threads.Should().HaveCount(1); dbPattern.Threads.Should().BeEquivalentTo(expectedThread); HasEntries <Pattern>(1); HasEntries <ThreadBase>(1); }
public void DeleteThread() { var patternThread = new PatternThread { ThreadReference = ThreadReferences.Data[0] }; UnderTest.Model.Threads = patternThread.AsList(); UnderTest.DeleteThreadCommand.Execute(patternThread); UnderTest.Model.Threads.Should().BeEmpty(); }