Beispiel #1
0
        public void MappingTest()
        {
            //Arrange
            var dataStorage = new Mock <IDataStorage>();
            var entity      = new Visit {
                Id                = 1,
                Caption           = "old",
                OrderNo           = 1,
                ExpectedVisitDate = DateTime.Today.AddDays(-1),
                VisitDate         = DateTime.Today.AddDays(-2),
                VisitTime         = DateTime.Now,
                VisitType         = VisitType.AdverseEventVisit,
                Patient           = new Patient()
            };
            var updatedEntity = new Visit
            {
                Id                = 1,
                Caption           = "new",
                OrderNo           = 2,
                ExpectedVisitDate = DateTime.Today.AddDays(-2),
                VisitDate         = DateTime.Today.AddDays(-3),
                VisitTime         = DateTime.Now,
                VisitType         = VisitType.Day1,
                Patient           = new Patient()
            };
            var repository = new VisitRepository(dataStorage.Object);

            dataStorage.Setup(ds => ds.GetData <Visit>()).Returns(new List <Visit> {
                entity
            });
            //Act
            repository.Edit(updatedEntity);
            //Assert
            //Values are equal
            Assert.That(entity.Caption, Is.EqualTo(updatedEntity.Caption));
            Assert.That(entity.ExpectedVisitDate, Is.EqualTo(updatedEntity.ExpectedVisitDate));
            Assert.That(entity.OrderNo, Is.EqualTo(updatedEntity.OrderNo));
            Assert.That(entity.VisitDate, Is.EqualTo(updatedEntity.VisitDate));
            Assert.That(entity.VisitTime, Is.EqualTo(updatedEntity.VisitTime));
            Assert.That(entity.VisitType, Is.EqualTo(updatedEntity.VisitType));
            Assert.That(entity.Patient, Is.EqualTo(updatedEntity.Patient));
        }
        public void MappingTest()
        {
            //Arrange
            var dataStorage = new Mock<IDataStorage>();
            var entity = new Visit {
                Id = 1,
                Caption = "old",
                OrderNo = 1,
                ExpectedVisitDate = DateTime.Today.AddDays(-1),
                VisitDate = DateTime.Today.AddDays(-2),
                VisitTime = DateTime.Now,
                VisitType = VisitType.AdverseEventVisit,
                Patient = new Patient()
            };
            var updatedEntity = new Visit
            {
                Id = 1,
                Caption = "new",
                OrderNo = 2,
                ExpectedVisitDate = DateTime.Today.AddDays(-2),
                VisitDate = DateTime.Today.AddDays(-3),
                VisitTime = DateTime.Now,
                VisitType = VisitType.Day1,
                Patient = new Patient()
            };
            var repository = new VisitRepository(dataStorage.Object);

            dataStorage.Setup(ds => ds.GetData<Visit>()).Returns(new List<Visit> { entity });
            //Act
            repository.Edit(updatedEntity);
            //Assert
            //Values are equal
            Assert.That(entity.Caption, Is.EqualTo(updatedEntity.Caption));
            Assert.That(entity.ExpectedVisitDate, Is.EqualTo(updatedEntity.ExpectedVisitDate));
            Assert.That(entity.OrderNo, Is.EqualTo(updatedEntity.OrderNo));
            Assert.That(entity.VisitDate, Is.EqualTo(updatedEntity.VisitDate));
            Assert.That(entity.VisitTime, Is.EqualTo(updatedEntity.VisitTime));
            Assert.That(entity.VisitType, Is.EqualTo(updatedEntity.VisitType));
            Assert.That(entity.Patient, Is.EqualTo(updatedEntity.Patient));
        }