Esempio n. 1
0
        public void CreateVitalSign_GivenValidArguments_CreatesVitalSign()
        {
            var activityType = new Mock<ActivityType> ();
            var lookupValueRepository = new Mock<ILookupValueRepository> ();
            lookupValueRepository
                .Setup ( l => l.GetLookupByWellKnownName<ActivityType> ( It.IsAny<string> () ) )
                .Returns ( activityType.Object );

            var vitalSignRepository = new Mock<IVitalSignRepository> ();

            var vitalSignFactory = new VitalSignFactory (
                vitalSignRepository.Object,
                lookupValueRepository.Object );

            var visit = new Mock<Visit> ();
            var clinicalCase = new Mock<ClinicalCase> ();
            var patient = new Mock<Patient> ();

            visit.Setup ( v => v.ClinicalCase ).Returns ( clinicalCase.Object );
            clinicalCase.Setup ( c => c.Patient ).Returns ( patient.Object );

            var vitalSign = vitalSignFactory.CreateVitalSign ( visit.Object );

            Assert.IsNotNull ( vitalSign );
        }
Esempio n. 2
0
        public void CreateVitalSign_GivenValidArguments_VitalSignIsEditable()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                var activityType = new Mock<ActivityType>();
                var lookupValueRepository = new Mock<ILookupValueRepository>();
                lookupValueRepository
                    .Setup(l => l.GetLookupByWellKnownName<ActivityType>(It.IsAny<string>()))
                    .Returns(activityType.Object);

                var vitalSignRepository = new Mock<IVitalSignRepository>();

                var vitalSignFactory = new VitalSignFactory(
                    vitalSignRepository.Object,
                    lookupValueRepository.Object);

                var visit = new Mock<Visit>();
                var clinicalCase = new Mock<ClinicalCase>();
                var patient = new Mock<Patient>();

                visit.Setup(v => v.ClinicalCase).Returns(clinicalCase.Object);
                clinicalCase.Setup(c => c.Patient).Returns(patient.Object);

                var vitalSign = vitalSignFactory.CreateVitalSign(visit.Object);

                vitalSign.ReviseHeight ( new Height ( 100, null ) );
            }
        }
Esempio n. 3
0
        public void CreateVitalSign_GivenValidArguments_VitalSignIsMadePersistent()
        {
            var isPersistent = false;

            var activityType = new Mock<ActivityType> ();
            var lookupValueRepository = new Mock<ILookupValueRepository> ();
            lookupValueRepository
                .Setup ( l => l.GetLookupByWellKnownName<ActivityType> ( It.IsAny<string> () ) )
                .Returns ( activityType.Object );

            var vitalSignRepository = new Mock<IVitalSignRepository> ();
            vitalSignRepository
                .Setup ( v => v.MakePersistent ( It.IsAny<VitalSign> () ) )
                .Callback ( () => isPersistent = true );

            var vitalSignFactory = new VitalSignFactory (
                vitalSignRepository.Object,
                lookupValueRepository.Object );

            var visit = new Mock<Visit> ();
            var clinicalCase = new Mock<ClinicalCase> ();
            var patient = new Mock<Patient> ();

            visit.Setup ( v => v.ClinicalCase ).Returns ( clinicalCase.Object );
            clinicalCase.Setup ( c => c.Patient ).Returns ( patient.Object );

            vitalSignFactory.CreateVitalSign ( visit.Object );

            Assert.IsTrue ( isPersistent );
        }
Esempio n. 4
0
        public void CreateVitalSign_NullVisit_ThrowsArgumentException()
        {
            var activityType = new Mock<ActivityType> ();
            var lookupValueRepository = new Mock<ILookupValueRepository> ();
            lookupValueRepository
                .Setup ( l => l.GetLookupByWellKnownName<ActivityType> ( It.IsAny<string> () ) )
                .Returns ( activityType.Object );

            var vitalSignRepository = new Mock<IVitalSignRepository> ();

            var vitalSignFactory = new VitalSignFactory (
                vitalSignRepository.Object,
                lookupValueRepository.Object );

            vitalSignFactory.CreateVitalSign ( null );
        }