public void Map_NullScript_ReturnsNull_Test()
        {
            //Arange
            var dummyRoleMapper = new RoleMapper();
            var dummyUserMapper = new UserMapper(dummyRoleMapper);
            var dummyOptionMapper = new OptionsMapper();
            var dummySectionMapper = new SectionMapper();

            IScriptMapper mapper = new ScriptMapper(dummyUserMapper, dummyOptionMapper,
                dummySectionMapper, new CookieParser());

            //Assert
            Assert.That(mapper.Map(script: null), Is.Null);
        }
        public void Map_toTransfer_Test()
        {
            //Arange
            var dummyRoleMapper = new RoleMapper();
            var dummyUserMapper = new UserMapper(dummyRoleMapper);
            var dummyOptionMapper = new OptionsMapper();
            var dummySectionMapper = new SectionMapper();

            IScriptMapper mapper = new ScriptMapper(dummyUserMapper, dummyOptionMapper,
                dummySectionMapper, new CookieParser());

            var script = new Script
            {
                EntityState = EntityState.Unchanged,
                OperatorId = 99,
                ScriptId = 99,
                Title = "test",
                CreatedDate = new DateTime(1, 1, 1),
                LastEditedDate = new DateTime(1, 1, 1),
                OptionsId = 99,
                PrompterId = 99,
                Options = null,
                Operator = null,
                Prompter = null
            };

            var expected = new ComparableTransferScript
            {
                EntityState = EntityState.Unchanged,
                OperatorId = 99,
                ScriptId = 99,
                Title = "test",
                CreatedDate = new DateTime(1, 1, 1),
                LastEditedDate = new DateTime(1, 1, 1),
                OptionsId = 99,
                PrompterId = 99,
                Options = null,
                Operator = null,
                Prompter = null
            };

            //Act
            var actual = mapper.Map(script);

            //Assert
            Assert.That(actual, Is.EqualTo(expected));
            Assert.That(actual.Options, Is.Null);
            Assert.That(actual.Operator, Is.Null);
            Assert.That(actual.Prompter, Is.Null);
        }
        public void Map_DependencyMap_Test()
        {
            // Arrange
            var dummyRoleMapper = new RoleMapper();
            var dummyUserMapper = new UserMapper(dummyRoleMapper);
            var dummyOptionMapper = new OptionsMapper();
            var dummySectionMapper = new SectionMapper();

            IScriptMapper mapper = new ScriptMapper(dummyUserMapper, dummyOptionMapper,
                dummySectionMapper, new CookieParser());

            var script = new Script
            {
                Options = new Options
                {
                    AnnouncerName = "test"
                },
                Operator = new User
                {
                    UserId = 1
                },
                Prompter = new User
                {
                    UserId = 1
                }
            };

            var expected = new ComparableTransferScript
            {
                Options = new TransferOptions
                {
                    AnnouncerName = "test"
                },
                Operator = new TransferUser
                {
                    UserId = 1
                },
                Prompter = new TransferUser
                {
                    UserId = 1
                }
            };

            //Act:
            var actual = mapper.Map(script);

            //Assert
            Assert.That(actual.Options.AnnouncerName,
                Is.EqualTo(expected.Options.AnnouncerName));

            Assert.That(actual.Operator.UserId,
                Is.EqualTo(expected.Operator.UserId));

            Assert.That(actual.Prompter.UserId,
                Is.EqualTo(expected.Prompter.UserId));
        }