public void UpdateGeneratorDetail_GeneratorNotFound(int ID, string descriptionAdd, string userID)
        {
            var generatorDto = new GeneratorDto
            {
                ID = ID,
                ModelDescription           = descriptionAdd,
                SelectedVoltageNominalList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                },
                SelectedRegulatoryFilterList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                },
                SelectedAlternatorList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                }
            };

            var actualResult = _adminProcessor.SaveGeneratorDetail(generatorDto, userID);

            _generatorRepository.Update(Arg.Any <Generator>().DidNotReceive());
        }
 public HttpResponseMessage SaveGeneratorDetail(GeneratorDto generatorResponseDto)
 {
     return(CreateHttpResponse(() =>
     {
         return Request.CreateResponse(_adminProcessor.SaveGeneratorDetail(generatorResponseDto, generatorResponseDto.UserName));
     }));
 }
        public void UpdateGeneratorDetail_Successfully(int ID, string descriptionAdd, string userID)
        {
            var generatorDto = new GeneratorDto
            {
                ID = ID,
                ModelDescription           = descriptionAdd,
                SelectedVoltageNominalList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                },
                SelectedRegulatoryFilterList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                },
                SelectedAlternatorList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                }
            };

            var updatedGenerator = new Generator
            {
                ID = ID,
                ModelDescription = descriptionAdd
            };

            _generatorRepository.Find(ID).ReturnsForAnyArgs(LoadGeneratorList().FirstOrDefault(x => x.ID == generatorDto.ID));
            _generatorRepository.Update(Arg.Any <Generator>()).Returns(updatedGenerator);
            var actualResult = _adminProcessor.SaveGeneratorDetail(generatorDto, userID);

            Assert.AreEqual(updatedGenerator.ID, actualResult.ID);
        }
        public void AddGeneratorDetail_Successfully(int ID, string descriptionAdd, string userID)
        {
            var generatorDto = new GeneratorDto
            {
                ID = ID,
                ModelDescription           = descriptionAdd,
                SelectedVoltageNominalList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                },
                SelectedRegulatoryFilterList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                },
                SelectedAlternatorList = new List <PickListDto> {
                    new PickListDto {
                        ID = 1,
                    }
                }
            };

            var addedGenerator = new Generator
            {
                ID = 1,
                ModelDescription = descriptionAdd
            };

            _generatorRepository.Add(Arg.Any <Generator>()).Returns(addedGenerator);
            var actualResult = _adminProcessor.SaveGeneratorDetail(generatorDto, userID);

            Assert.AreEqual(addedGenerator.ID, actualResult.ID);
        }
 private void PickListDetailForGenerator(GeneratorDto generatorPickListDto)
 {
     generatorPickListDto.FrequencyList        = _pickListProcessor.GetFrequency();
     generatorPickListDto.VoltageNominalList   = _pickListProcessor.GetVoltageNominal(false);
     generatorPickListDto.ProductFamilyList    = _pickListProcessor.GetProductFamily();
     generatorPickListDto.RegulatoryFilterList = _pickListProcessor.GetRegulatoryFilter();
     generatorPickListDto.FuelTypeList         = _pickListProcessor.GetFuelTypeCode();
 }
        public void DeleteGenerator_GeneratorNotFound(int ID, string userID)
        {
            var generatorDto = new GeneratorDto
            {
                ID = ID
            };

            _generatorRepository.
            GetSingle(x => x.ID == generatorDto.ID).
            ReturnsForAnyArgs(LoadGeneratorList().FirstOrDefault(x => x.ID == generatorDto.ID));

            var actualResult = _adminProcessor.DeleteGenerator(generatorDto.ID, userID);

            _generatorRepository.Update(Arg.Any <Generator>().DidNotReceive());
        }
        public void DeleteGenerator_Successfully(int ID, string userID)
        {
            var generatorDto = new GeneratorDto
            {
                ID = ID
            };

            var updatedGenerator = new Generator
            {
                ID     = ID,
                Active = false
            };

            _generatorRepository.
            GetSingle(x => x.ID == generatorDto.ID).
            ReturnsForAnyArgs(LoadGeneratorList().FirstOrDefault(x => x.ID == generatorDto.ID));
            _generatorRepository.Update(Arg.Any <Generator>()).Returns(updatedGenerator);
            var actualResult = _adminProcessor.DeleteGenerator(generatorDto.ID, userID);

            Assert.AreEqual(actualResult, true);
        }