public void MapFrom_Should_CorrectlyMapFrom_BarCommentDto_To_BarCommentViewModel() { //Arrange var sut = new BarCommentViewModelMapper(); var barComment = new BarCommentDto { Id = Guid.NewGuid(), BarId = Guid.NewGuid(), UserId = Guid.NewGuid(), UserName = "******", Body = "testBody", CreatedOn = DateTime.MinValue, }; //Act var result = sut.MapFrom(barComment); //Assert Assert.AreEqual(result.Id, barComment.Id); Assert.AreEqual(result.BarId, barComment.BarId); Assert.AreEqual(result.UserId, barComment.UserId); Assert.AreEqual(result.UserName, barComment.UserName); Assert.AreEqual(result.Body, barComment.Body); Assert.AreEqual(result.CreatedOn, barComment.CreatedOn); }
public void MapFrom_Should_ReturnCorrectInstanceOfCollection_BarCommentDto() { //Arrange var sut = new BarCommentViewModelMapper(); var barComment = new List <BarCommentDto> { new BarCommentDto { Id = Guid.NewGuid(), BarId = Guid.NewGuid(), UserId = Guid.NewGuid(), UserName = "******", Body = "testBody", CreatedOn = DateTime.MinValue, }, new BarCommentDto { Id = Guid.NewGuid(), BarId = Guid.NewGuid(), UserId = Guid.NewGuid(), UserName = "******", Body = "testBody2", CreatedOn = DateTime.MinValue, }, }; //Act var result = sut.MapFrom(barComment); //Assert Assert.IsInstanceOfType(result, typeof(List <BarCommentViewModel>)); }
public void MapFromCollection_Should_ReturnCorrectCountCommentBars() { //Arrange var sut = new BarCommentViewModelMapper(); var barComment = new List <BarCommentDto> { new BarCommentDto { Id = Guid.NewGuid(), BarId = Guid.NewGuid(), UserId = Guid.NewGuid(), UserName = "******", Body = "testBody", CreatedOn = DateTime.MinValue, }, new BarCommentDto { Id = Guid.NewGuid(), BarId = Guid.NewGuid(), UserId = Guid.NewGuid(), UserName = "******", Body = "testBody2", CreatedOn = DateTime.MinValue, }, }; //Act var result = sut.MapFrom(barComment); //Assert Assert.AreEqual(2, result.Count()); }