Esempio n. 1
0
        public void TestProjectController_ProjectEdit(string httpMethod)
        {
            SetUpProjectControllerForTesting(httpMethod);
            projectController.CurrentUser = user;

            ViewResult result = projectController.ProjectEdit(projectId, null, null) as ViewResult;

            Assert.That(result, Is.Not.EqualTo(null));
            Assert.That(result.ViewName, Is.EqualTo("ProjectEdit"));

            Project      project = this.db.Projects.Where(p => p.OwnerId == user.UserId && p.ProjectId == projectId).FirstOrDefault();
            ProjectModel model   = result.Model as ProjectModel;

            Assert.That(model.ProjectId, Is.EqualTo(projectId));
            Assert.That(model.ProjectLeadStatusTypeId, Is.EqualTo(project.ProjectLeadStatusTypeId));
            Assert.That(model.ProjectOpenStatusTypeId, Is.EqualTo(project.ProjectOpenStatusTypeId));
            Assert.That(model.ProjectStatusTypeId, Is.EqualTo((byte)project.ProjectStatusTypeId));
            Assert.That(model.ProjectTypeId, Is.EqualTo(project.ProjectTypeId));
            Assert.That(model.SellerAddress.AddressId, Is.EqualTo(project.SellerAddressId));
            Assert.That(model.ShipToAddress.AddressId, Is.EqualTo(project.ShipToAddressId));
            Assert.That(model.CustomerAddress.AddressId, Is.EqualTo(project.CustomerAddressId));
            Assert.That(model.EngineerAddress.AddressId, Is.EqualTo(project.EngineerAddressId));
            Assert.That(model.ConstructionTypeId, Is.EqualTo(project.ConstructionTypeId));
            Assert.That(model.Active, Is.EqualTo(Convert.ToBoolean(project.ActiveVersion)));
            Assert.That(model.ActualCloseDate, Is.EqualTo(project.ActualCloseDate));
            Assert.That(model.BidDate, Is.EqualTo(project.BidDate));
            Assert.That(model.Name, Is.EqualTo(project.Name));
            Assert.That(model.NumberOfFloors, Is.EqualTo(project.NumberOfFloors));
            Assert.That(model.OwnerId, Is.EqualTo(user.UserId));
            Assert.That(model.ProjectDate, Is.EqualTo(project.ProjectDate));
            Assert.That(model.VerticalMarketTypeId, Is.EqualTo(project.VerticalMarketTypeId));
        }