Esempio n. 1
0
        public void CanMapSprint_EditorViewModelToDomain()
        {
            var viewModel = new SprintEditorViewModel()
             {
            Id = Guid.NewGuid(),
            Name = "Test Me",
            Description = "This is a test.",
            StartDate = new DateTime( 2013, 3, 1 ),
            EndDate = new DateTime( 2013, 3, 31 ),
            Goal = "Get this thing tested",
            ProjectId = Projects.ModelData[2].Id,
            StatusId = SprintStatuses.ModelData[1].Id
             };
             var domainModel = Mapper.Map( viewModel, viewModel.GetType(), typeof( Sprint ) );

             Assert.AreEqual( viewModel.Id, ((Sprint)domainModel).Id );
             Assert.AreEqual( viewModel.Name, ((Sprint)domainModel).Name );
             Assert.AreEqual( viewModel.Description, ((Sprint)domainModel).Description );
             Assert.AreEqual( viewModel.Goal, ((Sprint)domainModel).Goal );
             Assert.AreEqual( viewModel.StartDate, ((Sprint)domainModel).StartDate );
             Assert.AreEqual( viewModel.EndDate, ((Sprint)domainModel).EndDate );
             Assert.AreEqual( viewModel.StatusId, ((Sprint)domainModel).Status.Id );
             Assert.AreEqual( viewModel.ProjectId, ((Sprint)domainModel).Project.Id );
        }
 private static void AssertModelAndViewModelPropertiesEqual( Sprint model, SprintEditorViewModel viewModel )
 {
     Assert.AreEqual( model.Id, viewModel.Id );
      Assert.AreEqual( model.Name, viewModel.Name );
      Assert.AreEqual( model.Description, viewModel.Description );
      Assert.AreEqual( model.Goal, viewModel.Goal );
      Assert.AreEqual( model.StartDate.ToString(), viewModel.StartDate.ToString() );
      Assert.AreEqual( model.EndDate.ToString(), viewModel.EndDate.ToString() );
      Assert.AreEqual( model.Capacity, viewModel.Capacity );
 }