public void Setup() { ILogger logger = new ConsoleOutLogger(); var entityContextFactory = new Mock <IEntityContextFactory>(); entityContextFactory .Setup(e => e.CreateContext()) .Returns(new NoDbEntityContext()); var dummyPlatformEntities = new Mock <IPlatformModuleEntities>(); dummyPlatformEntities.Setup(a => a.GetAll()).Returns(new List <PlatformModuleEntity>()); dummyPlatformEntities.Setup(a => a.GetPlatformModuleEntity(It.IsAny <PlatformModuleEntity>())) .Returns <PlatformModuleEntity>(b => b); _testee = new PlatformModule { EntityContextFactory = entityContextFactory.Object, PlatformModuleEntities = dummyPlatformEntities.Object, Logger = logger, CompositeAlarmManager = new CompositeAlarmManager(logger), Name = string.Empty }; _testee.Construct(); }
public void GivenTwoLinkedItems_WhenMoveOne_ShouldReleaseLinks() { var logger = new Mock <ILogger>(); var entityContextFactory = new EntityContextFactory(logger.Object); var dummy = new PlatformModule { EntityContextFactory = entityContextFactory, Logger = logger.Object, CompositeAlarmManager = new CompositeAlarmManager(logger.Object), Name = string.Empty }; dummy.Construct(); var item1 = new PlatformItem { ItemId = 1 }; var item2 = new PlatformItem { ItemId = 2 }; item1.ItemBehind = item2; item2.ItemInFront = item1; _testee.AddItem(item1); _testee.AddItem(item2); _testee.MoveItem(item1.ItemId, dummy); item1.ItemInFront.Should().BeNull(); item1.ItemBehind.Should().BeNull(); item2.ItemInFront.Should().BeNull(); item2.ItemBehind.Should().BeNull(); }