Exemplo n.º 1
0
        public void Not_Insert_More_EndPoint()
        {
            //Arrange
            var endPoint1 = new EndPoint
            {
                SerialNumber         = "1",
                MeterModelId         = EnumMeterModelId.NSX1P2W,
                MeterNumber          = 1,
                MeterFirmwareVersion = "A91200-1",
                SwitchState          = EnumSwitchState.Disconnected
            };
            var endPoint2 = new EndPoint
            {
                SerialNumber         = "1",
                MeterModelId         = EnumMeterModelId.NSX1P2W,
                MeterNumber          = 1,
                MeterFirmwareVersion = "A91200-1",
                SwitchState          = EnumSwitchState.Disconnected
            };

            _endPointDAO.Insert(endPoint1);
            _endPointService = new EndPointService(_endPointDAO);

            _mockRepo.Setup(x => x.Insert(endPoint1)).Returns(false);

            //Act
            var esperado  = _mockRepo.Object.Insert(endPoint1);
            var realizado = _endPointService.Insert(endPoint2);

            //Assert
            Assert.AreEqual(realizado, esperado);
        }
Exemplo n.º 2
0
        public void Edit_Success()
        {
            //Arrange
            var endPoint1 = new EndPoint
            {
                SerialNumber         = "1",
                MeterModelId         = EnumMeterModelId.NSX1P2W,
                MeterNumber          = 1,
                MeterFirmwareVersion = "A91200-1",
                SwitchState          = EnumSwitchState.Disconnected
            };
            var endPoint2 = new EndPoint
            {
                SerialNumber         = "1",
                MeterModelId         = EnumMeterModelId.NSX1P2W,
                MeterNumber          = 1,
                MeterFirmwareVersion = "A91200-1",
                SwitchState          = EnumSwitchState.Disconnected
            };

            var endPointFor = new EndPoint
            {
                SerialNumber         = "1",
                MeterModelId         = EnumMeterModelId.NSX1P2W,
                MeterNumber          = 1,
                MeterFirmwareVersion = "A91200-1",
                SwitchState          = EnumSwitchState.Armed
            };

            _endPointDAO.Insert(endPoint1);
            _endPointDAO.Insert(endPoint2);
            _endPointService = new EndPointService(_endPointDAO);

            _mockRepo.Setup(x => x.Edit(endPoint1, endPointFor)).Returns(true);

            //Act
            var esperado = _mockRepo.Object.Edit(endPoint1, endPointFor);

            var realizado = _endPointService.Edit(endPoint1, endPointFor);

            //Assert
            Assert.AreEqual(esperado, realizado);
        }
Exemplo n.º 3
0
 public Insert_EndPoint_Success()
 {
     _sutService = new EndPointService(_mockRepoDao.Object);
 }