예제 #1
0
        public void MapEntityToModelList()
        {
            var    mapper = new DALDeviceMapper();
            Device item   = new Device();

            item.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), true, "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            List <ApiDeviceServerResponseModel> response = mapper.MapEntityToModel(new List <Device>()
            {
                { item }
            });

            response.Count.Should().Be(1);
        }
예제 #2
0
        public void MapModelToEntity()
        {
            var mapper = new DALDeviceMapper();
            ApiDeviceServerRequestModel model = new ApiDeviceServerRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), true, "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            Device response = mapper.MapModelToEntity(1, model);

            response.DateOfLastPing.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.IsActive.Should().Be(true);
            response.Name.Should().Be("A");
            response.PublicId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
예제 #3
0
        public void MapEntityToModel()
        {
            var    mapper = new DALDeviceMapper();
            Device item   = new Device();

            item.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), true, "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            ApiDeviceServerResponseModel response = mapper.MapEntityToModel(item);

            response.DateOfLastPing.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Id.Should().Be(1);
            response.IsActive.Should().Be(true);
            response.Name.Should().Be("A");
            response.PublicId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }