public void Verify_Add_Should_AddTheEntityToTheContext() { // Arrange Mock <IDbSet <CreatorCharacter> > mockSetCreatorCharacters; var mockContext = CreatorCharactersMockingSetup.DoMockingSetupForContext(false, out mockSetCreatorCharacters); var repository = new CreatorCharactersRepository(mockContext.Object); var creatorCharacters = new CreatorCharacter { Active = true, CustomKey = "SALVATORE-RAA", }; // Act repository.Add(creatorCharacters); // Assert mockSetCreatorCharacters.Verify(x => x.Add(creatorCharacters), Times.Once); }
public void Verify_MapToEntity_WithExistingEntity_AssignsCreatorCharacterProperties() { // Arrange var mapper = new CreatorCharacterMapper(); var model = CreatorCharactersMockingSetup.DoMockingSetupForCreatorCharacterModel(); // Act ICreatorCharacter existingEntity = new CreatorCharacter { Id = 1 }; mapper.MapToEntity(model.Object, ref existingEntity); // Assert // <None> // Related Objects Assert.Equal(model.Object.PersonId, existingEntity.PersonId); Assert.Equal(model.Object.CharacterId, existingEntity.CharacterId); // Associated Objects // <None> }