public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<CharacterAlias>> mockSetCharacterAliases;
     var mockContext = CharacterAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterAliases);
     var repository = new CharacterAliasesRepository(mockContext.Object);
     var characterAliases = new CharacterAlias { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(characterAliases);
     // Assert
     mockSetCharacterAliases.Verify(x => x.Add(characterAliases), Times.Once);
 }
 public void Verify_MapToEntity_WithExistingEntity_AssignsCharacterAliasProperties()
 {
     // Arrange
     var mapper = new CharacterAliasMapper();
     var model = CharacterAliasesMockingSetup.DoMockingSetupForCharacterAliasModel();
     // Act
     ICharacterAlias existingEntity = new CharacterAlias { Id = 1 };
     mapper.MapToEntity(model.Object, ref existingEntity);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId);
     // Associated Objects
     // <None>
 }
Exemplo n.º 3
0
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <CharacterAlias> > mockSetCharacterAliases;
            var mockContext      = CharacterAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetCharacterAliases);
            var repository       = new CharacterAliasesRepository(mockContext.Object);
            var characterAliases = new CharacterAlias {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(characterAliases);
            // Assert
            mockSetCharacterAliases.Verify(x => x.Add(characterAliases), Times.Once);
        }
        public void Verify_MapToEntity_WithExistingEntity_AssignsCharacterAliasProperties()
        {
            // Arrange
            var mapper = new CharacterAliasMapper();
            var model  = CharacterAliasesMockingSetup.DoMockingSetupForCharacterAliasModel();
            // Act
            ICharacterAlias existingEntity = new CharacterAlias {
                Id = 1
            };

            mapper.MapToEntity(model.Object, ref existingEntity);
            // Assert
            // <None>
            // Related Objects
            Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId);
            // Associated Objects
            // <None>
        }