public void Can_Delete_CustomData_From_Project()
        {
            // Arrange

            var eventBusMock = new Mock <IEventBus>();

            var projectMock = new Project
            {
                ProjectCustomData = new List <ProjectCustomData>
                {
                    new ProjectCustomData {
                        ConfigurationName = "test"
                    }
                }
            };

            var projectRepositoryMock = new Mock <IProjectRepository>();

            projectRepositoryMock.Setup(m => m.GetByIdWithCustomDatas(It.IsAny <int>())).Returns(projectMock);

            // Act

            var target = new DeleteCustomDataFromProject(projectRepositoryMock.Object, eventBusMock.Object);

            target.Invoke(1, "test");

            // Assert

            projectRepositoryMock.Verify(m => m.Edit(projectMock));
            Assert.True(!projectMock.ProjectCustomData.Any());
        }
        public void Cannot_Delete_CustomData_From_Project_With_No_Custom_Data()
        {
            // Arrange

            var eventBusMock = new Mock <IEventBus>();

            var projectRepositoryMock = new Mock <IProjectRepository>();

            projectRepositoryMock.Setup(m => m.GetByIdWithCustomDatas(It.IsAny <int>())).Returns(new Project());

            // Act

            var target = new DeleteCustomDataFromProject(projectRepositoryMock.Object, eventBusMock.Object);

            // Assert

            var ex = Assert.Throws <Exception>(() => target.Invoke(1, "test"));

            Assert.True(ex.Message.Contains("Could not find custom data (name:"));
        }