public void FreeToPlayPeriodControllerDeleteTest()
        {
            // Arrange
            DateTime now = DateTime.Now;
            Hero expectedHero = HeroTest.Create();
            const string expectedEncyptedId = "Id";
            FreeToPlayPeriod expectedPeriod = expectedHero.AddFreeToPlayPeriod(now, now.AddDays(1), now);
            Hero actualHero = null;

            Mock<IHeroRepository> heroRepositoryMock = new Mock<IHeroRepository>();
            heroRepositoryMock
                .Setup(hr => hr.GetHero(It.IsAny<Guid>()))
                .Returns(expectedHero);
            heroRepositoryMock
                .Setup(hr => hr.Save(It.IsAny<Hero>()))
                .Callback<Hero>(h => actualHero = h);

            Mock<ICryptographyService> cryptographyServiceMock = new Mock<ICryptographyService>();
            cryptographyServiceMock
                .Setup(cs => cs.DecryptGuid(It.Is<string>(i => i == expectedEncyptedId)))
                .Returns(expectedPeriod.Id);

            // Act
            OkResult actual =
                new FreeToPlayPeriodController(heroRepositoryMock.Object, cryptographyServiceMock.Object)
                    .Delete(expectedEncyptedId, "hero") as OkResult;

            // Assert
            Assert.IsNotNull(actual);
            Assert.IsFalse(expectedHero.FreeToPlayPeriods.Any());
        }
        public void FreeToPlayPeriodControllerPostTest()
        {
            // Arrange
            DateTime now = DateTime.Now;
            Hero expectedHero = HeroTest.Create();
            DateTime expectedBegin = now;
            DateTime expectedEnd = now.AddDays(1);
            Hero actualHero = null;

            Mock<IHeroRepository> heroRepositoryMock = new Mock<IHeroRepository>();
            heroRepositoryMock
                .Setup(hr => hr.Save(It.IsAny<Hero>()))
                .Callback<Hero>(h => actualHero = h);
            Mock<ICryptographyService> cryptographyServiceMock = new Mock<ICryptographyService>();

            FreeToPlayPeriodPropertiesModel model = new FreeToPlayPeriodPropertiesModel(expectedHero, expectedBegin, expectedEnd);

            // Act
            OkNegotiatedContentResult<FreeToPlayPeriodViewModel> actual =
                new FreeToPlayPeriodController(heroRepositoryMock.Object, cryptographyServiceMock.Object)
                    .Post(model) as OkNegotiatedContentResult<FreeToPlayPeriodViewModel>;

            // Assert
            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual.Content);
            Assert.AreEqual(expectedHero, actualHero);
            Assert.AreEqual(expectedBegin, actual.Content.Begin);
            Assert.AreEqual(expectedEnd, actual.Content.End);
        }