コード例 #1
0
        public void ReturnsNewDomainRecordRequestWhenNull()
        {
            DNSRecordToDigitalOceanCreateDomainRecordRequestConverter converter = new DNSRecordToDigitalOceanCreateDomainRecordRequestConverter();
            DNSRecord record = new DNSRecord()
            {
                Data     = "DNSData",
                Flags    = 1,
                Name     = "DNSName",
                Port     = 1,
                Priority = 1,
                Tag      = "DNSTag",
                TTL      = 1,
                Weight   = 1,
                Type     = DNSRecordType.A
            };

            DigitalOceanCreateDomainRecordRequest actual = converter.Convert(record, null, _mappingHelper.ResolutionContext);

            Assert.Equal(record.Data, actual.Data);
            Assert.Equal(record.Flags, actual.Flags);
            Assert.Equal(record.Name, actual.Name);
            Assert.Equal(record.Port, actual.Port);
            Assert.Equal(record.Priority, actual.Priority);
            Assert.Equal(record.Tag, actual.Tag);
            Assert.Equal(record.TTL, actual.Ttl);
            Assert.Equal(record.Weight, actual.Weight);
            Assert.Equal(DNSRecordType.A.Value, actual.Type);
        }
コード例 #2
0
        public void OverwirtesCreateDomainRecordRequestValues()
        {
            DNSRecordToDigitalOceanCreateDomainRecordRequestConverter converter = new DNSRecordToDigitalOceanCreateDomainRecordRequestConverter();
            DNSRecord record = new DNSRecord()
            {
                Data     = "DNSData",
                Flags    = 1,
                Name     = "DNSName",
                Port     = 1,
                Priority = 1,
                Tag      = "DNSTag",
                TTL      = 1,
                Weight   = 1,
                Type     = DNSRecordType.A
            };

            DigitalOceanCreateDomainRecordRequest createRecord = new DigitalOceanCreateDomainRecordRequest()
            {
                Data     = "CreatData",
                Flags    = 123,
                Name     = "CreateName",
                Port     = 123,
                Priority = 123,
                Tag      = "DNSTag",
                Ttl      = 123,
                Weight   = 123,
                Type     = "Some other type"
            };

            DigitalOceanCreateDomainRecordRequest actual = converter.Convert(record, createRecord, _mappingHelper.ResolutionContext);

            Assert.Equal(record.Data, actual.Data);
            Assert.Equal(record.Flags, actual.Flags);
            Assert.Equal(record.Name, actual.Name);
            Assert.Equal(record.Port, actual.Port);
            Assert.Equal(record.Priority, actual.Priority);
            Assert.Equal(record.Tag, actual.Tag);
            Assert.Equal(record.TTL, actual.Ttl);
            Assert.Equal(record.Weight, actual.Weight);
            Assert.Equal(DNSRecordType.A.Value, actual.Type);
        }