예제 #1
0
        public void ToModel_does_return_editied_entity(string newName, Hero hero)
        {
            //Arrange
            var sut = new EditableHeroViewModel(hero);

            //Act
            sut.HeroName = newName;
            var newHero = sut.ToModel();

            //Assert
            newHero.Should().BeEquivalentTo(hero, option => option.Excluding(x => x.HeroName));
            newHero.HeroName.Should().Be(newName);
        }
예제 #2
0
        public void ToModel_throw_exception_if_invalid_property(string newName, Hero hero)
        {
            //Arrange
            var newHeroName = Enumerable.Range(0, 200).Select(x => newName).Aggregate((a, b) => a + b);
            var sut         = new EditableHeroViewModel(hero);

            //Act
            sut.HeroName = newHeroName;
            var toModel = new Action(() => sut.ToModel());

            //Assert
            toModel.Should().Throw <ValidationException>();
        }
예제 #3
0
        public void Restore_should_restore_properties(Hero hero, string newHeroName, string newRealName)
        {
            //Arrange
            var sut = new EditableHeroViewModel(hero);

            sut.HeroName = newHeroName;
            sut.RealName = newRealName;

            //Act
            sut.Restore();

            //Assert
            sut.ToModel().Should().BeEquivalentTo(hero);
        }
예제 #4
0
        public void Constructor_initialize_properties_correctly(Hero hero)
        {
            //Arrange
            EditableHeroViewModel sut = default;

            //Act
            sut = new EditableHeroViewModel(hero);

            //Assert
            sut.HeroName.Should().Be(hero.HeroName);
            sut.HeroName_ko.Should().Be(hero.HeroName_ko);
            sut.RealName.Should().Be(hero.RealName);
            sut.Comment.Should().Be(hero.Summary);
            sut.Role.Should().Be(hero.Role);
            sut.SignatureColor.Should().Be(hero.SignatureColor_Hex);
        }