示例#1
0
        public void Insert_AlreadyExistsInContext_False()
        {
            // Arrange
            var logic   = new PatientLogic(new PatientRepo(new MemoryPatientContext()));
            var patient = GenerateValidPatient();

            // Act
            logic.Insert(patient);
            var isAccepted = logic.Insert(patient);

            // Assert
            Assert.False(isAccepted);
        }
示例#2
0
        public void Insert_ValidPatient_True()
        {
            // Arrange
            var logic   = new PatientLogic(new PatientRepo(new MemoryPatientContext()));
            var patient = GenerateValidPatient();

            // Act
            var isAccepted = logic.Insert(patient);

            // Assert
            Assert.True(isAccepted);
        }
示例#3
0
        public void Update_ValidPatient_True()
        {
            // Arrange
            var logic           = new PatientLogic(new PatientRepo(new MemoryPatientContext()));
            var existingPatient = GenerateValidPatient();
            var patient         = existingPatient;

            // Act
            logic.Insert(existingPatient);
            var isAccepted = logic.Update(patient);

            // Assert
            Assert.True(isAccepted);
        }
示例#4
0
        public void Insert_NameWhitespace_False()
        {
            // Arrange
            var logic   = new PatientLogic(new PatientRepo(new MemoryPatientContext()));
            var patient = new Patient
            {
                Name       = " ",
                Age        = 18,
                IsApproved = false
            };

            // Act
            var isAccepted = logic.Insert(patient);

            // Assert
            Assert.False(isAccepted);
        }
示例#5
0
        public void Insert_NegativeAge_False()
        {
            // Arrange
            var logic   = new PatientLogic(new PatientRepo(new MemoryPatientContext()));
            var patient = new Patient()
            {
                Name       = "Mark",
                Age        = -6,
                IsApproved = false
            };

            // Act
            var isAccepted = logic.Insert(patient);

            // Assert
            Assert.False(isAccepted);
        }
示例#6
0
        public void Update_NameWhitespace_False()
        {
            // Arrange
            var logic           = new PatientLogic(new PatientRepo(new MemoryPatientContext()));
            var existingPatient = GenerateValidPatient();
            var patient         = new Patient
            {
                Name       = " ",
                Age        = 18,
                IsApproved = false
            };

            // Act
            logic.Insert(existingPatient);
            var isAccepted = logic.Update(patient);

            // Assert
            Assert.False(isAccepted);
        }