コード例 #1
0
        public void AddProjectDataModel_DuplicateItem()
        {
            var projectDataModelService = new ProjectDataModelService(_dataModelRepository.Object, _propertyRepository.Object, _projectRepository.Object);
            var exception = Record.ExceptionAsync(() => projectDataModelService.AddProjectDataModel(1, "Product", null, null, null, null));

            Assert.IsType <DuplicateProjectDataModelException>(exception?.Result);
        }
コード例 #2
0
        public void AddProjectDataModel_InvalidProject()
        {
            var projectDataModelService = new ProjectDataModelService(_dataModelRepository.Object, _propertyRepository.Object, _projectRepository.Object);
            var exception = Record.ExceptionAsync(() => projectDataModelService.AddProjectDataModel(2, "Category", null, null, null, null));

            Assert.IsType <ProjectNotFoundException>(exception?.Result);
        }
コード例 #3
0
        public async void AddProjectDataModel_ValidItem()
        {
            var projectDataModelService = new ProjectDataModelService(_dataModelRepository.Object, _propertyRepository.Object, _projectRepository.Object);
            int newId = await projectDataModelService.AddProjectDataModel(1, "Category", null, null, null, null);

            Assert.True(newId > 1);
            Assert.True(_data.Count > 1);

            var newData = _data.First(a => a.Id == newId);

            Assert.NotNull(newData.Label);
        }