public void ShouldSeeProfileForm()
        {
            // arrange
            var controller = new ProfileController(this.MembershipService, this.FormsAuthentication);

            // act
            var actual = (ViewResult)controller.Index();

            // assert
            Assert.That(actual.ViewName, Is.EqualTo(string.Empty));
            Assert.That(actual.Model, Is.TypeOf(typeof(ProfileViewModel)));
        }
        public void ShouldBeAbleToCallSaveProfileMethod()
        {
            // arrange
            var controller = new ProfileController(this.MembershipService, this.FormsAuthentication);
            var profileView = new ProfileViewModel
                {
                    FirstName = "Vitali",
                    LastName = "Hatalski",
                    NotifyOnOrderStatusChanged = true,
                    NotifyOnPackageStatusChanged = true
                };

            // act
            var actual = ((JsonNetResult)controller.Save(profileView)).Data as ProfileViewModel;

            // assert
            Assert.That(actual, Is.Not.Null);
            if (actual != null)
            {
                Assert.That(actual.MessageType, Is.EqualTo(MessageType.Success.ToString()));
            }
        }
        public void ShouldNotBeAbleToSaveInvalidProfileView()
        {
            // arrange
            var controller = new ProfileController(this.MembershipService, this.FormsAuthentication);
            controller.ViewData.ModelState.Clear();

            var profileViewModel = new ProfileViewModel
            {
                FirstName = "Vitali",
                LastName = string.Empty,
                NotifyOnOrderStatusChanged = true,
                NotifyOnPackageStatusChanged = true
            };

            // act
            var actual = controller.Save(profileViewModel) as JsonNetResult;

            // assert
            Assert.That(actual, Is.Not.Null);
            if (actual != null)
            {
                var model = actual.Data as ProfileViewModel;
                Debug.Assert(model != null, "model != null");
                Assert.That(model.MessageType, Is.EqualTo(MessageType.Warning.ToString()));
            }
        }