Ejemplo n.º 1
0
        public void GetDefault_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new KupahRepository(context);
            var service    = new KupahService(repository);

            // Act
            KupahModel result = service.GetDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsDefault);
        }
Ejemplo n.º 2
0
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new KupahRepository(context);
            var service    = new KupahService(repository);

            // Act
            IEnumerable <KupahModel> result = service.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.kupah.Count(), result.Count());
        }
Ejemplo n.º 3
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new KupahRepository(context);
            var service    = new KupahService(repository);
            int id         = 1;

            // Act
            KupahModel result = service.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.Id);
        }
Ejemplo n.º 4
0
        public void ConvertModelToEntity_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var        service           = new KupahService();
            KupahModel model             = GetTestModel();

            // Act
            kupah entity = service.ConvertModelToEntity(model);

            // Assert
            Assert.IsNotNull(entity);
            Assert.AreEqual(entity.name, model.Name);
            Assert.AreEqual(entity.isDefault, model.IsDefault);
            Assert.AreEqual(entity.isCurrent, model.IsCurrent);
            Assert.AreEqual(entity.isPrivate, model.IsPrivate);
        }
Ejemplo n.º 5
0
        public void ConvertEntityToModel_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var   service = new KupahService();
            kupah entity  = context.kupah.Where(x => x.id == 1).FirstOrDefault();

            // Act
            KupahModel model = service.ConvertEntityToModel(entity);

            // Assert
            Assert.IsNotNull(model);
            Assert.AreEqual(model.Id, entity.id);
            Assert.AreEqual(model.Name, entity.name);
            Assert.AreEqual(model.IsDefault, entity.isDefault);
            Assert.AreEqual(model.IsCurrent, entity.isCurrent);
        }