public void GivenTankLivestockDto_ReturnsTankLivestockResponse() { // Arrange var tankLivestock = new TankLivestockListDto { LivestockId = Guid.NewGuid(), Name = "This is livestock", Sex = LivestockSex.Female, Happiness = TankLivestockHappiness.Happy, Healthy = true, LastFed = DateTime.Now.AddDays(-1), UntilNextFeed = new TimeSpan(1, 1, 1, 1, 1) }; // Act var result = tankLivestock.ToResponse(); // Assert Assert.Multiple(() => { Assert.That(result.LivestockId, Is.EqualTo(tankLivestock.LivestockId)); Assert.That(result.Name, Is.EqualTo(tankLivestock.Name)); Assert.That(result.Sex, Is.EqualTo(tankLivestock.Sex)); Assert.That(result.Happiness, Is.EqualTo(tankLivestock.Happiness)); Assert.That(result.Healthy, Is.EqualTo(tankLivestock.Healthy)); Assert.That(result.LastFed, Is.EqualTo(tankLivestock.LastFed)); Assert.That(result.UntilNextFeed, Is.EqualTo(tankLivestock.UntilNextFeed)); }); }
public static TankLivestockResponse ToResponse(this TankLivestockListDto tankLivestockList) { return(new TankLivestockResponse { LivestockId = tankLivestockList.LivestockId, Name = tankLivestockList.Name, Sex = tankLivestockList.Sex, Happiness = tankLivestockList.Happiness, Healthy = tankLivestockList.Healthy, LastFed = tankLivestockList.LastFed, UntilNextFeed = tankLivestockList.UntilNextFeed }); }