public void SavingNewOrderWithThread() { var order = UnderTest.Model; UpdateOrder(order); var expectedThread = new { Length = 2, ThreadReferenceId = 1 }; var thread = new OrderThread { Length = expectedThread.Length, ThreadReferenceId = expectedThread.ThreadReferenceId }; order.Threads = thread.AsList(); UnderTest.SaveCommand.Execute(null); var dbOrder = _orderRepository.GetAll().Last(); dbOrder.Should().BeEquivalentTo(order, opt => opt.Excluding(o => o.Threads)); dbOrder.Threads.Should().HaveCount(1); dbOrder.Threads.Should().BeEquivalentTo(expectedThread); HasEntries <Order>(1); HasEntries <ThreadBase>(1); }
public void DeleteThreadFromDatabase() { var order = UnderTest.Model; UpdateOrder(order); var expectedThread = new { Length = 2, ThreadReferenceId = 1 }; var thread = new OrderThread { Length = expectedThread.Length, ThreadReferenceId = expectedThread.ThreadReferenceId }; order.Threads = thread.AsList(); UnderTest.SaveCommand.Execute(null); HasEntries <Order>(1); HasEntries <ThreadBase>(1); UnderTest.DeleteThreadCommand.Execute(thread); UnderTest.SaveCommand.Execute(null); HasEntries <Order>(1); HasEntries <ThreadBase>(0); }
public void DeleteThreadFromOrder() { var orderThread = new OrderThread { ThreadReference = ThreadReferences.Data[0] }; var order = UnderTest.Model; order.Threads = orderThread.AsList(); UnderTest.DeleteThreadCommand.Execute(orderThread); order.Threads.Should().BeEmpty(); }