///<summary> /// Returns a Typed VProductAndDescription Entity with mock values. ///</summary> static public VProductAndDescription CreateMockInstance() { VProductAndDescription mock = new VProductAndDescription(); mock.ProductId = TestUtility.Instance.RandomNumber(); mock.Name = TestUtility.Instance.RandomString(24, false);; mock.ProductModel = TestUtility.Instance.RandomString(24, false);; mock.CultureId = TestUtility.Instance.RandomString(6, false);; mock.Description = TestUtility.Instance.RandomString(199, false);; return((VProductAndDescription)mock); }
/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.VProductAndDescription Convert(VProductAndDescription item) { WsProxy.VProductAndDescription outItem = new WsProxy.VProductAndDescription(); outItem.ProductId = item.ProductId; outItem.Name = item.Name; outItem.ProductModel = item.ProductModel; outItem.CultureId = item.CultureId; outItem.Description = item.Description; return(outItem); }
public virtual BOVProductAndDescription MapEFToBO( VProductAndDescription ef) { var bo = new BOVProductAndDescription(); bo.SetProperties( ef.CultureID, ef.Description, ef.Name, ef.ProductID, ef.ProductModel); return(bo); }
public virtual VProductAndDescription MapBOToEF( BOVProductAndDescription bo) { VProductAndDescription efVProductAndDescription = new VProductAndDescription(); efVProductAndDescription.SetProperties( bo.CultureID, bo.Description, bo.Name, bo.ProductID, bo.ProductModel); return(efVProductAndDescription); }
/// <summary> /// Deserialize the mock VProductAndDescription entity from a temporary file. /// </summary> private void Step_7_DeserializeEntity_Generated() { string fileName = "temp_VProductAndDescription.xml"; XmlSerializer mySerializer = new XmlSerializer(typeof(VProductAndDescription)); System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open); mock = (VProductAndDescription)mySerializer.Deserialize(myFileStream); myFileStream.Close(); System.IO.File.Delete(fileName); System.Console.WriteLine("mock correctly deserialized from a temporary file."); }
/// <summary> /// Convert a nettiers collection to the ws proxy collection. /// </summary> public static VProductAndDescription Convert(WsProxy.VProductAndDescription item) { VProductAndDescription outItem = new VProductAndDescription(); outItem.ProductId = item.ProductId; outItem.Name = item.Name; outItem.ProductModel = item.ProductModel; outItem.CultureId = item.CultureId; outItem.Description = item.Description; outItem.AcceptChanges(); return(outItem); }
public void MapEFToBOList() { var mapper = new DALVProductAndDescriptionMapper(); VProductAndDescription entity = new VProductAndDescription(); entity.SetProperties("A", "A", "A", 1, "A"); List <BOVProductAndDescription> response = mapper.MapEFToBO(new List <VProductAndDescription>() { entity }); response.Count.Should().Be(1); }
public void MapEFToBO() { var mapper = new DALVProductAndDescriptionMapper(); VProductAndDescription entity = new VProductAndDescription(); entity.SetProperties("A", "A", "A", 1, "A"); BOVProductAndDescription response = mapper.MapEFToBO(entity); response.CultureID.Should().Be("A"); response.Description.Should().Be("A"); response.Name.Should().Be("A"); response.ProductID.Should().Be(1); response.ProductModel.Should().Be("A"); }
public void MapBOToEF() { var mapper = new DALVProductAndDescriptionMapper(); var bo = new BOVProductAndDescription(); bo.SetProperties("A", "A", "A", 1, "A"); VProductAndDescription response = mapper.MapBOToEF(bo); response.CultureID.Should().Be("A"); response.Description.Should().Be("A"); response.Name.Should().Be("A"); response.ProductID.Should().Be(1); response.ProductModel.Should().Be("A"); }
public async void Get() { var mock = new ServiceMockFacade <IVProductAndDescriptionRepository>(); var record = new VProductAndDescription(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(record)); var service = new VProductAndDescriptionService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.VProductAndDescriptionModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLVProductAndDescriptionMapperMock, mock.DALMapperMockFactory.DALVProductAndDescriptionMapperMock); ApiVProductAndDescriptionResponseModel response = await service.Get(default(string)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>())); }