public void MustCreateAendpoint() { //arrange PersistenceMock persistenceMock = new PersistenceMock(); var createEndpoint = new CreateEndpoint(persistenceMock.CreateEndpoint()); //action createEndpoint.Execute(ModelsMock.EndpointMock()); //assert Assert.Empty(createEndpoint.Error); }
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); }
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); }
public void MustReturnAlistWith2enpoints() { //arrange PersistenceMock persistenceMock = new PersistenceMock(); persistenceMock.SearchBySerialNumber(); var listAllEndpoints = new ListAllEndpoints(persistenceMock.ListAll()); //action var endpoints = listAllEndpoints.Execute(); //assert Assert.Equal(ModelsMock.ListEndpointMock().Count, endpoints.Count); Assert.NotNull(endpoints); }
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); }
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); }
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"); }