Exemplo n.º 1
0
        public void IsNotValid_IfNoProjectStatusAssigned()
        {
            var project = new Project( _sessionFactory.Object )
             {
            Id = Guid.NewGuid(),
            Name = "New Project",
            Description = "This is just for testing"
             };

             Assert.IsFalse( project.IsValidFor( TransactionType.All ) );
             var messages = project.GetErrorMessages();
             Assert.AreEqual( 1, messages.Count );
             Assert.AreEqual( "The Status field is required.", messages["Status"] );
        }
Exemplo n.º 2
0
        public void IsNotValid_IfDifferentProjectWithSameNameExists()
        {
            var project = new Project( _sessionFactory.Object )
             {
            Id = Guid.NewGuid(),
            Name = Projects.ModelData[0].Name,
            Description = "This is just for testing",
            Status = ProjectStatuses.ModelData[0]
             };

             Assert.IsFalse( project.IsValidFor( TransactionType.All ) );
             var messages = project.GetErrorMessages();
             Assert.AreEqual( 1, messages.Count );
             Assert.AreEqual( String.Format( ErrorMessages.NameIsNotUnique, "Project", project.Name ), messages["Name"] );
        }