public void Verify_Add_Should_AddTheEntityToTheContext()
 {
     // Arrange
     Mock<IDbSet<ObjectAlias>> mockSetObjectAliases;
     var mockContext = ObjectAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetObjectAliases);
     var repository = new ObjectAliasesRepository(mockContext.Object);
     var objectAliases = new ObjectAlias { Active = true, CustomKey = "SALVATORE-RAA", };
     // Act
     repository.Add(objectAliases);
     // Assert
     mockSetObjectAliases.Verify(x => x.Add(objectAliases), Times.Once);
 }
        public void Verify_Add_Should_AddTheEntityToTheContext()
        {
            // Arrange
            Mock <IDbSet <ObjectAlias> > mockSetObjectAliases;
            var mockContext   = ObjectAliasesMockingSetup.DoMockingSetupForContext(false, out mockSetObjectAliases);
            var repository    = new ObjectAliasesRepository(mockContext.Object);
            var objectAliases = new ObjectAlias {
                Active = true, CustomKey = "SALVATORE-RAA",
            };

            // Act
            repository.Add(objectAliases);
            // Assert
            mockSetObjectAliases.Verify(x => x.Add(objectAliases), Times.Once);
        }
Example #3
0
        public void Verify_MapToEntity_WithExistingEntity_AssignsObjectAliasProperties()
        {
            // Arrange
            var mapper = new ObjectAliasMapper();
            var model  = ObjectAliasesMockingSetup.DoMockingSetupForObjectAliasModel();
            // Act
            IObjectAlias existingEntity = new ObjectAlias {
                Id = 1
            };

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