public void UploadLogoCallsTheStoreWithTheLogo()
        {
            var mockTenantStore = new Mock<ITenantStore>();
            var mockLogoFile = new Mock<HttpPostedFileBase>();

            var logoBytes = new byte[1];
            using (var stream = new MemoryStream(logoBytes))
            {
                mockLogoFile.Setup(f => f.ContentLength).Returns(1);
                mockLogoFile.Setup(f => f.InputStream).Returns(stream);

                using (var controller = new AccountController(mockTenantStore.Object, null))
                {
                    controller.UploadLogo("tenant", mockLogoFile.Object);
                }
            }

            mockTenantStore.Verify(r => r.UploadLogo("tenant", logoBytes), Times.Once());
        }
        public void UploadLogoDoesNotCallTheStoreWhenContentLengthIs0()
        {
            var mockTenantStore = new Mock<ITenantStore>();
            var mockLogoFile = new Mock<HttpPostedFileBase>();
            mockLogoFile.Setup(f => f.ContentLength).Returns(0);

            using (var controller = new AccountController(mockTenantStore.Object, null))
            {
                controller.UploadLogo("tenant", mockLogoFile.Object);
            }

            mockTenantStore.Verify(r => r.UploadLogo(It.IsAny<string>(), It.IsAny<byte[]>()), Times.Never());
        }
        public void UploadLogoRedirectsToIndex()
        {
            var mockTenantStore = new Mock<ITenantStore>();

            using (var controller = new AccountController(mockTenantStore.Object, null))
            {
                var result = controller.UploadLogo("tenant", new Mock<HttpPostedFileBase>().Object) as RedirectToRouteResult;

                Assert.AreEqual("Index", result.RouteValues["action"]);
            }
        }