Ejemplo n.º 1
0
        public void MustCreateAendpoint()
        {
            //arrange
            PersistenceMock persistenceMock = new PersistenceMock();
            var             createEndpoint  = new CreateEndpoint(persistenceMock.CreateEndpoint());

            //action

            createEndpoint.Execute(ModelsMock.EndpointMock());

            //assert
            Assert.Empty(createEndpoint.Error);
        }
Ejemplo n.º 2
0
        public void MustEditStateAendpoint()
        {
            //arrange
            var state    = 3;
            var endpoint = ModelsMock.EndpointMock();

            //action

            endpoint.EditState(state);

            //assert
            Assert.Equal(state, endpoint.State);
        }
Ejemplo n.º 3
0
        public void MustDeleteAendpoint()
        {
            //arrange
            PersistenceMock persistenceMock = new PersistenceMock();
            var             deleteEndpoint  = new DeleteEndpoint(persistenceMock.DeleteEndpoint());

            //action

            deleteEndpoint.Execute(ModelsMock.EndpointMock().SerialNumber);

            //assert
            Assert.Empty(deleteEndpoint.Error);
        }
Ejemplo n.º 4
0
        public void MustEditStateAendpoint()
        {
            //arrange
            PersistenceMock persistenceMock = new PersistenceMock();

            persistenceMock.SearchBySerialNumber();
            var editEndpoint = new EditStateEndpoint(persistenceMock.EditStateEndpoint());

            //action

            editEndpoint.Execute(ModelsMock.EndpointMock().SerialNumber, ModelsMock.EndpointMock().State);
            //assert
            Assert.Empty(editEndpoint.Error);
        }
Ejemplo n.º 5
0
        public void MustReturnTheMeterModelIdOfTheSerialNumberNSX1P2W()
        {
            //arrange
            PersistenceMock persistenceMock     = new PersistenceMock();
            var             endpointPersistence = new Mock <IEndpointPersistence>();

            var validateSerialNumberOfEndpoint = new ValidateSerialNumberOfEndpoint(endpointPersistence.Object);

            //action
            var meterModelId = validateSerialNumberOfEndpoint.Execute(ModelsMock.EndpointMock().SerialNumber);

            //assert
            Assert.Empty(validateSerialNumberOfEndpoint.Error);
            Assert.Equal(ModelsMock.EndpointMock().MeterModelId, meterModelId);
        }
Ejemplo n.º 6
0
        public void MustSearchForAnEndpointByTheSerialNumberAndReturnAnotNullObject()
        {
            //arrange
            PersistenceMock persistenceMock = new PersistenceMock();

            persistenceMock.SearchBySerialNumber();
            var searchBySerialNumber = new SearchBySerialNumber(persistenceMock.SearchBySerialNumber());

            //action
            var endpoint = searchBySerialNumber.Execute(ModelsMock.EndpointMock().SerialNumber);

            //assert
            Assert.Empty(searchBySerialNumber.Error);
            Assert.Equal(ModelsMock.EndpointMock().SerialNumber, endpoint.SerialNumber);
            Assert.NotNull(endpoint);
        }
Ejemplo n.º 7
0
        public void MustReturnAnExistingEndpoint()
        {
            //arrange
            string          key, value;
            PersistenceMock persistenceMock = new PersistenceMock();
            var             validateSerialNumberOfEndpoint = new ValidateSerialNumberOfEndpoint(persistenceMock.SearchBySerialNumber());

            //action
            var meterModelId = validateSerialNumberOfEndpoint.Execute(ModelsMock.EndpointMock().SerialNumber);

            key   = validateSerialNumberOfEndpoint.Error.First().Key;
            value = validateSerialNumberOfEndpoint.Error.First().Value;

            //assert
            Assert.True(validateSerialNumberOfEndpoint.Error.Count > 0);
            Assert.True(meterModelId == 0);
            Assert.True(key == "Endpoint" && value == "An endpoint with this serial number already exists");
        }