Exemple #1
0
        public void MapFromDomainEntity_NullContent_ReturnNull()
        {
            //Act
            var response = LeasedOrOwned.MapFromDomainEntity(null);

            //Assert
            Assert.IsNull(response);
        }
Exemple #2
0
        public static LeasedOrOwnedDTO MapFromDatabaseEntity(LeasedOrOwned leasedOrOwned)
        {
            if (leasedOrOwned == null)
            {
                return(null);
            }

            return(new LeasedOrOwnedDTO()
            {
                Id = leasedOrOwned.Id,
                Value = leasedOrOwned.Value,
                Position = leasedOrOwned.Position
            });
        }
        public void MapFromDomainEntity_ValidEntity_ReturnDTOEntity()
        {
            //Arrange
            var leasedOrOwned = new LeasedOrOwned()
            {
                Id       = Guid.NewGuid(),
                Value    = "AMER",
                Position = 0
            };
            var response = LeasedOrOwnedDTO.MapFromDatabaseEntity(leasedOrOwned);

            Assert.IsNotNull(response);
            Assert.AreEqual(leasedOrOwned.Id, response.Id);
            Assert.AreEqual(leasedOrOwned.Value, response.Value);
            Assert.AreEqual(leasedOrOwned.Position, response.Position);
        }
        private static void SeedLeasedOrOwned(CapRedV2Context context)
        {
            if (context.LeasedOrOwneds.Any())
            {
                return;
            }
            string[] leasedOrOwneds = { "Leased", "Owned" };

            for (int i = 0; i < leasedOrOwneds.Length; i++)
            {
                var leasedOrOwned = new LeasedOrOwned {
                    Id = Guid.NewGuid(), Position = i, Value = leasedOrOwneds[i]
                };
                context.LeasedOrOwneds.Add(leasedOrOwned);
            }
        }