Example #1
0
        public void CMBuilder_buildNewHeldItemRowCM_ValidCall()
        {
            List <Item> items        = CreateTestData.GetListOfItems();
            var         itemsMockSet = new Mock <DbSet <Item> >()
                                       .SetupData(items, o =>
            {
                return(items.Single(x => x.Item_id.CompareTo(o.First()) == 0));
            });
            HeldItemRowCM expected = CharacterMapper.mapItemToHeldItemRowCM(CreateTestData.GetSampleItem());
            Item          record   = CreateTestData.GetSampleItem();

            expected.Count      = 1;
            expected.isAttuned  = false;
            expected.isEquipped = false;
            using (var mockContext = AutoMock.GetLoose())
            {
                mockContext.Mock <ItemsContext>()
                .Setup(x => x.Set <Item>()).Returns(itemsMockSet.Object);
                mockContext.Mock <ItemsContext>()
                .Setup(x => x.Items).Returns(itemsMockSet.Object);

                IUnitOfWork     uow    = UoW_Factory.getUnitofWork(mockContext);
                IBaseUserAccess access = UserAccessFactory.getBaseUserAccess(uow);

                //Act
                ICharacterCMBuilder toTest = ProcessorFactory.GetCharacterCMBuilder(access);
                var actual = toTest.buildNewHeldItemRowCM(record.Item_id);

                actual.Should().BeEquivalentTo(expected);
            }
        }
 public HeldItemRowCM CharacterObtainsItem(Guid user_id, Guid character_id, Guid Item_id)
 {
     return(_builder.buildNewHeldItemRowCM(Item_id));
 }