public void SetUp()
        {
            converter = new CustomerConverter();

            fakeEntity = new Customer
            {
                Id = NumberFaker.Number(1, int.MaxValue),
                Name = StringFaker.Alpha(25),
                StreetAddress = new Address
                {
                    Address1 = LocationFaker.Street(),
                    Address2 = LocationFaker.Street(),
                    City = LocationFaker.City(),
                    State = StringFaker.Alpha(2),
                    PostalCode = LocationFaker.PostCode(),
                    Country = LocationFaker.Country()
                },
                BillingAddress = new Address
                {
                    Address1 = LocationFaker.Street(),
                    Address2 = LocationFaker.Street(),
                    City = LocationFaker.City(),
                    State = StringFaker.Alpha(2),
                    PostalCode = LocationFaker.PostCode(),
                    Country = LocationFaker.Country()
                },
                OfficePhone1 = PhoneFaker.Phone(),
                OfficePhone2 = PhoneFaker.Phone(),
                OfficeFax = PhoneFaker.Phone(),
                Email = InternetFaker.Email(),
                PrimaryContact = new HumanContact
                {
                    FirstName = NameFaker.FirstName(),
                    LastName = NameFaker.LastName(),
                    Email = InternetFaker.Email(),
                    Fax = PhoneFaker.Phone(),
                    Phone1 = PhoneFaker.Phone(),
                    Phone2 = PhoneFaker.Phone(),
                    Notes = TextFaker.Sentence()
                },
                Notes = TextFaker.Sentences(5)
            };

            fakeViewModel = new CustomerViewModel
            {
                Id = NumberFaker.Number(1, int.MaxValue),
                Name = StringFaker.Alpha(25),
                CanLicensePreReleaseVersions = BooleanFaker.Boolean(),
                StreetAddress = new Address
                {
                    Address1 = LocationFaker.Street(),
                    Address2 = LocationFaker.Street(),
                    City = LocationFaker.City(),
                    State = StringFaker.Alpha(2),
                    PostalCode = LocationFaker.PostCode(),
                    Country = LocationFaker.Country()
                },
                BillingMatchesStreetAddress = BooleanFaker.Boolean(),
                BillingAddress = new Address
                {
                    Address1 = LocationFaker.Street(),
                    Address2 = LocationFaker.Street(),
                    City = LocationFaker.City(),
                    State = StringFaker.Alpha(2),
                    PostalCode = LocationFaker.PostCode(),
                    Country = LocationFaker.Country()
                },
                OfficePhone1 = PhoneFaker.Phone(),
                OfficePhone2 = PhoneFaker.Phone(),
                OfficeFax = PhoneFaker.Phone(),
                Email = InternetFaker.Email(),
                PrimaryContact = new HumanContact
                {
                    FirstName = NameFaker.FirstName(),
                    LastName = NameFaker.LastName(),
                    Email = InternetFaker.Email(),
                    Fax = PhoneFaker.Phone(),
                    Phone1 = PhoneFaker.Phone(),
                    Phone2 = PhoneFaker.Phone(),
                    Notes = TextFaker.Sentence()
                },
                Notes = TextFaker.Sentences(5)
            };
        }
        public void HttpPost_CreateMethod_InvalidData_RedisplaysSameView()
        {
            // NOTE: we can't actually mock the controller.modelstate propery
            // because it's not virtual, so moq can't handle it.
            // so, instead we do this to simulate a validation failure
            controller.ModelState.AddModelError("Id", new Exception("I'm a fake validation error."));
            Assert.That(controller.ModelState.IsValid, Is.False);

            var vm = new CustomerViewModel();
            var result = controller.Create(vm);

            // make sure we're not redirecting and that our viewmodel is the same
            Assert.That(result, Is.InstanceOf<ViewResult>());
            Assert.That(((ViewResult)result).Model, Is.SameAs(vm));
        }
 public void SetUp()
 {
     vm = new CustomerViewModel();
 }