Пример #1
0
        public void CanCreateValueSet()
        {
            // Arrange
            var apiModel = MockApiModelBuilder.ValueSetCreationApiModel("Custom Value Set");
            var emptyId  = Guid.Empty.ToString();

            // Act
            var attempt = this.valueSetService.Create(apiModel);

            // Assert
            attempt.Success.Should().BeTrue();
            attempt.Result.HasValue.Should().BeTrue();
            var valueSet = attempt.Result.Single();

            valueSet.Should().NotBeNull();
            valueSet.IsCustom.Should().BeTrue();
            valueSet.ValueSetUniqueId.Should().Be(emptyId);
            valueSet.ValueSetId.Should().Be(emptyId);
            valueSet.ValueSetOId.Should().Be(emptyId);
            valueSet.Name.Should().Be("Custom Value Set");
            foreach (var code in valueSet.ValueSetCodes)
            {
                code.ValueSetUniqueId.Should().Be(emptyId);
            }
        }
Пример #2
0
        public void CanDeleteValueSet()
        {
            // Arrange
            var apiModel = MockApiModelBuilder.ValueSetCreationApiModel("VS FOR DELETE", 25);
            var attempt  = this.valueSetService.Create(apiModel);

            attempt.Success.Should().BeTrue();
            attempt.Result.HasValue.Should().BeTrue();

            var vs = attempt.Result.Single();

            this.Profiler.ExecuteTimed(() => this.valueSetService.Save(vs), "ValueSet Save");

            vs.ValueSetUniqueId.Should().NotBe(Guid.Empty.ToString());
            vs.IsNew().Should().BeFalse();
            var uid = vs.ValueSetUniqueId;

            // Act
            this.valueSetService.Delete(vs);

            // Assert
            var retreived = this.valueSetRepository.GetCustomValueSet(uid);
            var codes     = this.valueSetCodeRepository.GetCustomValueSetCodes(uid, Enumerable.Empty <string>());

            retreived.HasValue.Should().BeFalse();
            codes.Should().BeEmpty();
        }
Пример #3
0
        public void CanAddValueSet(string name, int codeCount)
        {
            // Arrange
            var apiModel = MockApiModelBuilder.ValueSetCreationApiModel(name, codeCount);
            var attempt  = this.valueSetService.Create(apiModel);

            attempt.Success.Should().BeTrue();
            attempt.Result.HasValue.Should().BeTrue();

            var vs = attempt.Result.Single();

            // Act
            this.Profiler.ExecuteTimed(() => this.valueSetService.Save(vs));

            // Assert
            vs.ValueSetUniqueId.Should().NotBe(Guid.Empty.ToString());
            vs.ValueSetCodes.Count.Should().Be(codeCount);
            vs.Name.Should().BeEquivalentTo(name);
        }