示例#1
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("MethodName", MethodName);
            writer.WriteAttributeString("MethodDeclaringTypeName", MethodDeclaringTypeName);
            writer.WriteAttributeString("ReturnType", ReturnType);
            if (!string.IsNullOrWhiteSpace(ThrownExceptionType))
            {
                writer.WriteAttributeString("ThrownExceptionType", ThrownExceptionType);
            }
            writer.WriteStartElement("ReturnValue");
            Type returnType = Type.GetType(ReturnType);

            if (returnType != typeof(void))
            {
                writer.WriteRaw(XmlSerialiser.Serialise(ReturnValue, returnType, false, true));
            }
            writer.WriteEndElement();


            writer.WriteStartElement("Parameters");
            if (Parameters != null)
            {
                foreach (var parameter in Parameters)
                {
                    writer.WriteRaw(XmlSerialiser.Serialise(parameter, parameter.GetType(), false, true));
                }
            }
            writer.WriteEndElement();
        }
示例#2
0
        private static DataModel DeserializeHttpRequest(string text)
        {
            ISerialiser serialiser = new XmlSerialiser();
            var         dataModel  = serialiser.Deserialize <DataModel>(text);

            return(dataModel);
        }
        public void CanBeDeserialised()
        {
            var expected = new PluginConfiguration();

            var actual = new XmlSerialiser(new ConsoleLogManager()).Deserialise <PluginConfiguration>(SerialisedForm);

            actual.Should().BeEquivalentTo(expected);
        }
        public void CanBeSerialised()
        {
            var configuration = new PluginConfiguration();

            var serialised = new XmlSerialiser(new ConsoleLogManager()).Serialise(configuration);

            serialised.Should().Be(SerialisedForm);
        }
        public void WhenCharacterSetIsDefaultItIsNotSerialised()
        {
            var message = new SmsMessage();
            var serialiser = new XmlSerialiser();
            var serialisedMessage = serialiser.Serialise(message);

            Assert.That(serialisedMessage, Is.Not.StringContaining("characterset"));
        }
    public ActionSettings Run(string runnerXml)
    {
        MvcActionSettings         mvcActionSettings = XmlSerialiser.XmlDeserialise <MvcActionSettings>(runnerXml);
        IMvcActionSettingsCreator creator           = new MockPassThroughActionSettingsGenerator();

        Interfaces.ActionSettings v = creator.Create(mvcActionSettings);
        return(v);
    }
 public override string ToString()
 {
     return(String.Format("Method: '{0}'\nParams: {1}\nOutcome: {2}\nReturn Value: {3}",
                          Call.MethodName,
                          XmlSerialiser.Serialise(Call.Parameters),
                          Pass ? "Pass" : "Fail",
                          Pass ? SerialiseIfNotNull(Call.ReturnValue) : "Expected: " + ReturnValueOrException(Call.ReturnValue, Call.ThrownExceptionType)
                          + "\nActual: " + ReturnValueOrException(ActualCall.ReturnValue, ActualCall.ThrownExceptionType)));
 }
        public void WhenSmsMessageIsSerializedThenTheCharacterSetIsSerialisedAsExpected(CharacterSet characterSet, string expectedXml)
        {
            var message = new SmsMessage {CharacterSet = characterSet};

            var serialiser = new XmlSerialiser();
            var serialisedMessage = serialiser.Serialise(message);

            Assert.That(serialisedMessage, Is.EqualTo(expectedXml));
        }
        public bool Equals(object arg1, object arg2)
        {
            // TODO: requires serialisation to be unique

            var ser1 = arg1 != null ? (string)XmlSerialiser.Serialise(arg1) : "";
            var ser2 = arg2 != null ? (string)XmlSerialiser.Serialise(arg2) : "";

            return(ser1 == ser2);
        }
        internal ServiceBase(EsendexCredentials credentials)
        {
            var httpRequestHelper  = new HttpRequestHelper();
            var httpResponseHelper = new HttpResponseHelper();

            var httpClient = new HttpClient(credentials, Constants.API_URI, httpRequestHelper, httpResponseHelper);

            Serialiser = new XmlSerialiser();
            RestClient = new RestClient(httpClient);
        }
        public object Copy(object source)
        {
            if (source == null)
            {
                return(null);
            }
            var asXml = (string)XmlSerialiser.SerialiseWithoutNamespacesAndHeaderWithoutLinebreaks(source, source.GetType());

            return(XmlSerialiser.Deserialise(asXml, source.GetType()));
        }
        public void WhenCharacterSetIsSetShouldBeSerialised([Values(CharacterSet.Auto, CharacterSet.GSM, CharacterSet.Unicode)] CharacterSet characterSet)
        {
            var message = new SmsMessage();
            message.CharacterSet = characterSet;

            var serialiser = new XmlSerialiser();
            var serialisedMessage = serialiser.Serialise(message);

            Assert.That(serialiser.Deserialise<SmsMessage>(serialisedMessage).CharacterSet, Is.EqualTo(characterSet));
        }
示例#13
0
        public void ParseSeriesFile_ValidXml_ReturnsPictureFileName()
        {
            var fileContent = File.ReadAllText(TestContext.CurrentContext.TestDirectory + @"\TestData\anidb\series2.xml");

            var xmlFileParser = new XmlSerialiser(new ConsoleLogManager());

            var series = xmlFileParser.Deserialise <AniDbSeriesData>(fileContent);

            series.PictureFileName.Should().Be("64304.jpg");
        }
示例#14
0
        public void WriteXml(XmlWriter writer)
        {
            var type = Value != null?Value.GetType() : Type.GetType(ParameterActualType);

            writer.WriteAttributeString("Name", Name);
            writer.WriteAttributeString("ParameterActualType", type.AssemblyQualifiedName);
            writer.WriteAttributeString("ParameterExpectedType", ParameterExpectedType);
            writer.WriteStartElement("Value");
            writer.WriteRaw(XmlSerialiser.Serialise(Value, type, false, true));
            writer.WriteEndElement();
        }
        public void WhenSmsMessageIsSerializedThenTheCharacterSetIsSerialisedAsExpected(CharacterSet characterSet, string expectedXml)
        {
            var message = new SmsMessage {
                CharacterSet = characterSet
            };

            var serialiser        = new XmlSerialiser();
            var serialisedMessage = serialiser.Serialise(message);

            Assert.That(serialisedMessage, Is.EqualTo(expectedXml));
        }
示例#16
0
        public void ReadXml(XmlReader reader)
        {
            Name = reader["Name"];
            ParameterActualType   = reader["ParameterActualType"];
            ParameterExpectedType = reader["ParameterExpectedType"];
            reader.Read();
            reader.ReadStartElement("Value");
            Value = XmlSerialiser.Deserialise(reader.ReadOuterXml(), Type.GetType(ParameterActualType));

            reader.ReadEndElement();
            reader.ReadEndElement();
        }
示例#17
0
        public void CanSerialiseObject()
        {
            var u = new Parameter
            {
                Name = "fred",
                ParameterActualType = "System.Int32",
                Value = 128
            };

            string result = XmlSerialiser.SerialiseWithoutNamespacesAndHeaderWithLinebreaks(u, typeof(Parameter));

            Assert.IsTrue(result.Contains("128"));
        }
        public async Task Setup()
        {
            base.SharedSetup();

            Share1.Setup(s => s.ExistsAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(true);

            Share1.Setup(s => s.DownloadAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(_memoryStream = new MemoryStream());

            XmlSerialiser.Setup(s => s.Deserialize <GWallInfo>(It.IsAny <Stream>(), It.IsAny <Encoding>()))
            .ReturnsAsync(_analysisReportDeserialised = new GWallInfo());

            _output = await ClassInTest.GetDetailAsync(Input, CancellationToken.None);
        }
示例#19
0
        public void ReadXml(XmlReader reader)
        {
            MethodName = reader["MethodName"];
            MethodDeclaringTypeName = reader["MethodDeclaringTypeName"];
            ReturnType          = reader["ReturnType"];
            ThrownExceptionType = reader["ThrownExceptionType"];

            do
            {
                reader.Read();
                if (reader.Name == "ReturnValue")
                {
                    var returnType = Type.GetType(ReturnType);
                    var inner      = reader.ReadInnerXml();
                    if (returnType != typeof(void))
                    {
                        ReturnValue = XmlSerialiser.Deserialise(inner, returnType);
                    }
                }

                if (reader.Name == "Parameters")
                {
                    if (!reader.IsEmptyElement)
                    {
                        reader.ReadStartElement("Parameters");
                        var pl = new List <Parameter>();
                        while (reader.NodeType == XmlNodeType.Element)
                        {
                            var p = (Parameter)XmlSerialiser.Deserialise(reader.ReadOuterXml(), typeof(Parameter));
                            pl.Add(p);
                        }

                        Parameters = pl.ToArray();
                    }
                    else
                    {
                        Parameters = new Parameter[] {};
                    }
                    reader.Read();
                }
            } while (reader.NodeType != XmlNodeType.EndElement);
            reader.ReadEndElement();
        }
        public void DefaultDIConstructor()
        {
            // Arrange
            Uri uri = new Uri("http://tempuri.org");
            EsendexCredentials credentials = new EsendexCredentials("username", "password");
            IHttpRequestHelper httpRequestHelper = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();
            IHttpClient httpClient = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            IRestClient restClient = new RestClient(httpClient);
            ISerialiser serialiser = new XmlSerialiser();

            // Act
            SessionService serviceInstance = new SessionService(restClient, serialiser);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf<RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf<XmlSerialiser>());
        }
示例#21
0
        public void DefaultDIConstructor()
        {
            // Arrange
            Uri uri = new Uri("http://tempuri.org");
            EsendexCredentials  credentials        = new EsendexCredentials("username", "password");
            IHttpRequestHelper  httpRequestHelper  = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();
            IHttpClient         httpClient         = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            IRestClient restClient = new RestClient(httpClient);
            ISerialiser serialiser = new XmlSerialiser();

            // Act
            InboxService serviceInstance = new InboxService(restClient, serialiser);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf <RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf <XmlSerialiser>());
        }
        public void MessageCollection_WithoutBlankOriginator_ShouldNotSerialiseOriginator()
        {
            // Arrange
            SmsMessageCollection message = new SmsMessageCollection()
            {
                Originator = string.Empty
            };

            XmlSerialiser serialiser = new XmlSerialiser();

            // Act
            string serialisedXml = serialiser.Serialise(message);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element(ns + "messages").Element(ns + "from");

            Assert.IsNull(originator);
        }
示例#23
0
        public void MessageCollection_WithoutBlankOriginator_ShouldNotSerialiseOriginator()
        {
            // Arrange
            SmsMessageCollection message = new SmsMessageCollection()
            {
                Originator = string.Empty
            };

            XmlSerialiser serialiser = new XmlSerialiser();

            // Act
            string serialisedXml = serialiser.Serialise(message);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element(ns + "messages").Element(ns + "from");

            Assert.IsNull(originator);
        }
        public void Message_WithOriginator_SerialisesOriginator()
        {
            // Arrange
            SmsMessage message = new SmsMessage()
            {
                Originator = "07000000000"
            };

            XmlSerialiser serialiser = new XmlSerialiser();

            // Act
            string serialisedXml = serialiser.Serialise(message);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element("message").Element("from");

            Assert.IsNotNull(originator);
            Assert.AreEqual(message.Originator, originator.Value);
        }
示例#25
0
        public void MessageCollection_WithOriginator_SerialisesOriginator()
        {
            // Arrange
            SmsMessageCollection messages = new SmsMessageCollection()
            {
                Originator = "07000000000"
            };

            XmlSerialiser serialiser = new XmlSerialiser();

            // Act
            string serialisedXml = serialiser.Serialise(messages);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element(ns + "messages").Element(ns + "from");

            Assert.IsNotNull(originator);
            Assert.AreEqual(messages.Originator, originator.Value);
        }
        public void Message_WithoutBlankOriginator_ShouldNotSerialiseOriginator()
        {
            // Arrange
            var message = new SmsMessage
            {
                Originator = string.Empty
            };

            var serialiser = new XmlSerialiser();

            // Act
            var serialisedXml = serialiser.Serialise(message);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element("message")
                                     .Element("from");

            Assert.IsNull(originator);
        }
示例#27
0
        public void Message_WithoutBlankOriginator_ShouldNotSerialiseOriginator()
        {
            // Arrange
            var message = new SmsMessage
            {
                Originator = string.Empty
            };

            var serialiser = new XmlSerialiser();

            // Act
            var serialisedXml = serialiser.Serialise(message);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element("message")
                             .Element("from");

            Assert.IsNull(originator);
        }
        public void DefaultDIConstructor()
        {
            // Arrange
            var uri = new Uri("http://tempuri.org");
            var credentials = new EsendexCredentials("username", "password");
            IHttpRequestHelper httpRequestHelper = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();
            IHttpClient httpClient = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            IRestClient restClient = new RestClient(httpClient);
            ISerialiser serialiser = new XmlSerialiser();

            // Act
            var serviceInstance = new MessagingService(restClient, serialiser, true);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf<RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf<XmlSerialiser>());

            Assert.IsTrue(serviceInstance.EnsureMessageIdsInResult);
        }
示例#29
0
        public void DefaultDIConstructor()
        {
            // Arrange
            var uri         = new Uri("http://tempuri.org");
            var credentials = new EsendexCredentials("username", "password");
            IHttpRequestHelper  httpRequestHelper  = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();
            IHttpClient         httpClient         = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            IRestClient restClient = new RestClient(httpClient);
            ISerialiser serialiser = new XmlSerialiser();

            // Act
            var serviceInstance = new MessagingService(restClient, serialiser, true);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf <RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf <XmlSerialiser>());

            Assert.IsTrue(serviceInstance.EnsureMessageIdsInResult);
        }
示例#30
0
        public void Message_WithOriginator_SerialisesOriginator()
        {
            // Arrange
            var message = new SmsMessage
            {
                Originator = "07000000000"
            };

            var serialiser = new XmlSerialiser();

            // Act
            var serialisedXml = serialiser.Serialise(message);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element("message")
                             .Element("from");

            Assert.IsNotNull(originator);
            Assert.AreEqual(message.Originator, originator.Value);
        }
示例#31
0
        public static void GenerateSampleXml()
        {
            var actions = new List <PiAction>();

            actions.Add(new Model.PiAction()
            {
                Direction = "forward", Length = "24", Name = "Motor2"
            });
            actions.Add(new Model.PiAction()
            {
                Direction = "backward", Length = "24", Name = "Motor2"
            });

            DataModel dataModel = new DataModel();

            dataModel.Data = new Data()
            {
                PiActions = actions, Enable = false
            };
            XmlSerialiser xmlSerialiser = new XmlSerialiser();
            string        data          = xmlSerialiser.Serialize(dataModel);

            Console.WriteLine(data);
        }
示例#32
0
 private string SerialiseIfNotNull(object returnValue)
 {
     return(returnValue != null?XmlSerialiser.Serialise(returnValue) : "null");
 }
 public int GetHashCode(object arg1)
 {
     return((arg1 != null ? (string)XmlSerialiser.Serialise(arg1) : "").GetHashCode());
 }
示例#34
0
        public void ParseTitlesFile_ValidXml_ReturnsDeserialised()
        {
            var fileContent = File.ReadAllText(TestContext.CurrentContext.TestDirectory + @"\TestData\anidb\titles.xml");

            var xmlFileParser = new XmlSerialiser(new ConsoleLogManager());

            var titleList = xmlFileParser.Deserialise <TitleListData>(fileContent);

            titleList.Titles.Length.Should().Be(7964);

            titleList.Titles[0]
            .Should().BeEquivalentTo(new TitleListItemData
            {
                AniDbId = 1,
                Titles  = new[]
                {
                    new ItemTitleData
                    {
                        Type     = "short",
                        Language = "en",
                        Title    = "CotS"
                    },
                    new ItemTitleData
                    {
                        Type     = "official",
                        Language = "en",
                        Title    = "Crest of the Stars"
                    },
                    new ItemTitleData
                    {
                        Type     = "official",
                        Language = "pl",
                        Title    = "Crest of the Stars"
                    },
                    new ItemTitleData
                    {
                        Type     = "official",
                        Language = "fr",
                        Title    = "Crest of the Stars"
                    },
                    new ItemTitleData
                    {
                        Type     = "syn",
                        Language = "cs",
                        Title    = "Hvězdný erb"
                    },
                    new ItemTitleData
                    {
                        Type     = "main",
                        Language = "x-jat",
                        Title    = "Seikai no Monshou"
                    },
                    new ItemTitleData
                    {
                        Type     = "short",
                        Language = "x-jat",
                        Title    = "SnM"
                    },
                    new ItemTitleData
                    {
                        Type     = "syn",
                        Language = "zh-Hans",
                        Title    = "星界之纹章"
                    },
                    new ItemTitleData
                    {
                        Type     = "official",
                        Language = "ja",
                        Title    = "星界の紋章"
                    }
                }
            });
        }
        public void MessageCollection_WithOriginator_SerialisesOriginator()
        {
            // Arrange
            var messages = new SmsMessageCollection
            {
                Originator = "07000000000"
            };

            var serialiser = new XmlSerialiser();

            // Act
            var serialisedXml = serialiser.Serialise(messages);

            // Assert
            var document = XDocument.Parse(serialisedXml);

            var originator = document.Element(ns + "messages")
                                     .Element(ns + "from");

            Assert.IsNotNull(originator);
            Assert.AreEqual(messages.Originator, originator.Value);
        }
示例#36
0
        public void ParseSeriesFile_ValidXml_ReturnsDeserialised()
        {
            var fileContent = File.ReadAllText(TestContext.CurrentContext.TestDirectory + @"\TestData\anidb\series.xml");

            var xmlFileParser = new XmlSerialiser(new ConsoleLogManager());

            var series = xmlFileParser.Deserialise <AniDbSeriesData>(fileContent);

            series.Id.Should().Be(1);
            series.Restricted.Should().BeFalse();

            series.EpisodeCount.Should().Be(13);
            series.StartDate.Should().Be(new DateTime(1999, 1, 3));
            series.EndDate.Should().Be(new DateTime(1999, 3, 28));

            series.Titles.Should().BeEquivalentTo(new[]
            {
                new ItemTitleData
                {
                    Language = "x-jat",
                    Type     = "main",
                    Title    = "Seikai no Monshou"
                },
                new ItemTitleData
                {
                    Language = "cs",
                    Type     = "synonym",
                    Title    = "Hvězdný erb"
                },
                new ItemTitleData
                {
                    Language = "zh-Hans",
                    Type     = "synonym",
                    Title    = "星界之纹章"
                },
                new ItemTitleData
                {
                    Language = "en",
                    Type     = "short",
                    Title    = "CotS"
                },
                new ItemTitleData
                {
                    Language = "x-jat",
                    Type     = "short",
                    Title    = "SnM"
                },
                new ItemTitleData
                {
                    Language = "ja",
                    Type     = "official",
                    Title    = "星界の紋章"
                },
                new ItemTitleData
                {
                    Language = "en",
                    Type     = "official",
                    Title    = "Crest of the Stars"
                },
                new ItemTitleData
                {
                    Language = "fr",
                    Type     = "official",
                    Title    = "Crest of the Stars"
                },
                new ItemTitleData
                {
                    Language = "pl",
                    Type     = "official",
                    Title    = "Crest of the Stars"
                }
            });

            series.RelatedSeries.Should().BeEquivalentTo(new[]
            {
                new RelatedSeriesData
                {
                    Id    = 4,
                    Type  = "Sequel",
                    Title = "Seikai no Senki"
                },
                new RelatedSeriesData
                {
                    Id    = 6,
                    Type  = "Prequel",
                    Title = "Seikai no Danshou: Tanjou"
                },
                new RelatedSeriesData
                {
                    Id    = 1623,
                    Type  = "Summary",
                    Title = "Seikai no Monshou Tokubetsu Hen"
                }
            });

            series.SimilarSeries.Should().BeEquivalentTo(new[]
            {
                new SimilarSeriesData
                {
                    Id       = 584,
                    Approval = 70,
                    Total    = 84,
                    Title    = "Ginga Eiyuu Densetsu"
                },
                new SimilarSeriesData
                {
                    Id       = 2745,
                    Approval = 51,
                    Total    = 61,
                    Title    = "Starship Operators"
                },
                new SimilarSeriesData
                {
                    Id       = 6005,
                    Approval = 34,
                    Total    = 49,
                    Title    = "Tytania"
                },
                new SimilarSeriesData
                {
                    Id       = 192,
                    Approval = 18,
                    Total    = 40,
                    Title    = "Mugen no Ryvius"
                },
                new SimilarSeriesData
                {
                    Id       = 630,
                    Approval = 13,
                    Total    = 27,
                    Title    = "Uchuu no Stellvia"
                },
                new SimilarSeriesData
                {
                    Id       = 5406,
                    Approval = 3,
                    Total    = 15,
                    Title    = "Ookami to Koushinryou"
                },
                new SimilarSeriesData
                {
                    Id       = 18,
                    Approval = 2,
                    Total    = 10,
                    Title    = "Musekinin Kanchou Tylor"
                }
            });

            series.Url.Should().Be("http://www.sunrise-inc.co.jp/seikai/");

            series.Creators.Should().BeEquivalentTo(new[]
            {
                new CreatorData
                {
                    Id   = 4303,
                    Type = "Music",
                    Name = "Hattori Katsuhisa"
                },
                new CreatorData
                {
                    Id   = 4234,
                    Type = "Direction",
                    Name = "Nagaoka Yasuchika"
                },
                new CreatorData
                {
                    Id   = 4516,
                    Type = "Character Design",
                    Name = "Watabe Keisuke"
                },
                new CreatorData
                {
                    Id   = 8924,
                    Type = "Series Composition",
                    Name = "Yoshinaga Aya"
                },
                new CreatorData
                {
                    Id   = 4495,
                    Type = "Original Work",
                    Name = "Morioka Hiroyuki"
                }
            });

            series.Description.Should()
            .Be(
                "* Based on the sci-fi novel series by http://anidb.net/cr4495 [Morioka Hiroyuki].\nhttp://anidb.net/ch4081 [Linn Jinto]`s life changes forever when the http://anidb.net/ch7514 [Humankind Empire Abh] takes over his home planet of Martine without firing a single shot. He is soon sent off to study the http://anidb.net/t2324 [Abh] language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of, asked for, or even wanted.\nNow, Jinto is entering the next phase of his training, and he is about to meet the first Abh in his life, the lovely http://anidb.net/ch28 [Lafiel]. However, Jinto is about to learn that there is more to her than meets the eye, and together they will have to fight for their very lives.");

            series.Ratings.Should().BeEquivalentTo(new RatingData[]
            {
                new PermanentRatingData
                {
                    VoteCount = 4303,
                    Value     = 8.17f
                },
                new TemporaryRatingData
                {
                    VoteCount = 4333,
                    Value     = 8.26f
                },
                new ReviewRatingData
                {
                    VoteCount = 12,
                    Value     = 8.70f
                }
            });

            series.Tags.Length.Should().Be(51);
            series.Tags[0]
            .Should().BeEquivalentTo(new TagData
            {
                Id            = 36,
                ParentId      = 2607,
                Weight        = 300,
                LocalSpoiler  = false,
                GlobalSpoiler = false,
                Verified      = true,
                LastUpdated   = new DateTime(2017, 4, 17),
                Name          = "military",
                Description   =
                    "The military, also known as the armed forces, are forces authorized and legally entitled to use deadly force so as to support the interests of the state and its citizens. The task of the military is usually defined as defence of the state and its citizens and the prosecution of war against foreign powers. The military may also have additional functions within a society, including construction, emergency services, social ceremonies, and guarding critical areas.\nSource: Wikipedia"
            });

            series.Characters.Length.Should().Be(29);
            series.Characters[0]
            .Should().BeEquivalentTo(new CharacterData
            {
                Id     = 28,
                Role   = "main character in",
                Rating = new CharacterRatingData
                {
                    Value     = 9.31f,
                    VoteCount = 934
                },
                Name        = "Abriel Nei Debrusc Borl Paryun Lafiel",
                LastUpdated = new DateTime(2012, 7, 25),
                Gender      = "female",
                Type        = new CharacterType
                {
                    Id   = 1,
                    Name = "Character"
                },
                Description =
                    "Ablïarsec néïc Dubreuscr Bœrh Parhynr Lamhirh (a.k.a., Viscountess Paryunu Abriel Nei Dobrusk Lafiel) is the main female protagonist in the anime Crest of the Stars, Banner of the Stars, and Banner of the Stars II, as well as all the novels written by Morioka Hiroyuki on which the shows were based. She is a strong-willed Abh princess (granddaughter of the Abh empress) who has a steely exterior, but ends up befriending Ghintec Linn (Jinto Lynn in the Martinh tongue). Like all Abh, she has bluish hued hair, and has a natural lifespan of over 200 years. Lamhirh also has lapis lazuli colored eyes. As an Ablïarsec, she has pointed ears, yet hers are markedly less so than other Ablïarsec. This is because half her genes (those not from her father) are from someone outside the Abriel clan and her father chose not to make any unnecessary alterations in her genes. She is deemed \"child of love\" (an Abh child with the genes of the parent, and the one the parent loves). Her full name can be roughly translated to Lamhirh (néïc Dubleuscr) Ablïarsec, Viscountess of Parhyn.\nDespite being a princess, she rarely acts like one and hates being treated as one. One of the reasons she took a liking towards Ghintec is because when they first met, he neither recognized her as a princess nor treated her as one. Their relationship is so close that she freely allows him to use her real name of Lamhirh when addressing her, something that is very uncommon when addressing those of nobility or royalty.\nShe acts remarkably older than her age (at her introduction in Crest of the Stars, she is 16 years old) and can, in most cases, logically think her way out of most situations. However, her headstrong nature sometimes clouds her judgement and can lead her to become impulsive. An example of this is when she is reprimanded by Laicch for wishing to stay behind on the Gothlauth instead of continuing her mission of escorting Ghintec to the capital. She believes that she would have been of more use fighting with the crew rather than abandoning them. She is quickly shown how wrong her line of reasoning is and how much more disgraceful it would have been to abandon Ghintec and her mission. She is a remarkably good shot and although she sometimes doubts herself, she proves to be a worthy ship captain (deca-commander) in Banner of the Stars. She shows little emotion throughout Crest of the Stars, but as time goes by became very close friend with Ghintec through Banner of the Stars. This is especially true in later installments, where she more frequently questions how their friendship will last due to the doubt of Ghintec`s lifespan.\nShe is one of the candidates for the Abh Imperial Throne and, as indicated by her full name, she is the Viscountess of Parhynh, the so-called \"Country, or Nation, of Roses.\"",
                PictureFileName = "14304.jpg",
                Seiyuu          = new SeiyuuData
                {
                    Id = 12,
                    PictureFileName = "184301.jpg",
                    Name            = "Kawasumi Ayako"
                }
            });

            series.Episodes.Length.Should().Be(16);
            series.Episodes[0]
            .Should().BeEquivalentTo(new AniDbEpisodeData
            {
                Id               = 1,
                LastUpdated      = new DateTime(2011, 7, 1),
                RawEpisodeNumber = new EpisodeNumberData
                {
                    RawType   = 1,
                    RawNumber = "1"
                },
                TotalMinutes = 25,
                AirDate      = new DateTime(1999, 1, 3),
                Rating       = new EpisodeRatingData
                {
                    VoteCount = 28,
                    Rating    = 3.16f
                },
                Titles = new[]
                {
                    new EpisodeTitleData
                    {
                        Language = "ja",
                        Title    = "侵略"
                    },
                    new EpisodeTitleData
                    {
                        Language = "en",
                        Title    = "Invasion"
                    },
                    new EpisodeTitleData
                    {
                        Language = "fr",
                        Title    = "Invasion"
                    },
                    new EpisodeTitleData
                    {
                        Language = "x-jat",
                        Title    = "Shinryaku"
                    }
                }
            });
        }
示例#37
0
        public void CreateMappingListAsync_ParsesFileCorrectly()
        {
            var fileParser  = new XmlSerialiser(new ConsoleLogManager());
            var fileContent = File.ReadAllText(MappingsFilePath);

            var mappingList = fileParser.Deserialise <AnimeMappingListData>(fileContent);

            mappingList.AnimeSeriesMapping.Length.Should().Be(7427);
            mappingList.AnimeSeriesMapping[22]
            .Should().BeEquivalentTo(new AniDbSeriesMappingData
            {
                AnidbId           = "23",
                Name              = "Cowboy Bebop",
                TvDbId            = "76885",
                DefaultTvDbSeason = "1",
                GroupMappingList  = new[]
                {
                    new AnimeEpisodeGroupMappingData
                    {
                        EpisodeMappingString = ";1-2;",
                        AnidbSeason          = 0,
                        TvDbSeason           = 0
                    }
                },
                SupplementalInfo = new[]
                {
                    new AnimeSeriesSupplementalInfoData
                    {
                        Items = new object[]
                        {
                            "Sunrise"
                        },
                        ItemsElementName = new[]
                        {
                            ItemsChoiceType.studio
                        }
                    }
                }
            });

            mappingList.AnimeSeriesMapping[101]
            .Should().BeEquivalentTo(new AniDbSeriesMappingData
            {
                AnidbId           = "107",
                Name              = "Chikyuu Shoujo Arjuna",
                TvDbId            = "80113",
                DefaultTvDbSeason = "1",
                GroupMappingList  = new[]
                {
                    new AnimeEpisodeGroupMappingData
                    {
                        EpisodeMappingString = ";1-9;",
                        AnidbSeason          = 0,
                        TvDbSeason           = 1
                    },
                    new AnimeEpisodeGroupMappingData
                    {
                        EpisodeMappingString = null,
                        AnidbSeason          = 1,
                        TvDbSeason           = 1,
                        Start           = 9,
                        End             = 12,
                        Offset          = 1,
                        StartSpecified  = true,
                        EndSpecified    = true,
                        OffsetSpecified = true
                    }
                },
                SpecialEpisodePositionsString = ";1-9;"
            });
        }
        public DefaultData SerialiseTestData(string path = "Data/TestData/DefaultData.xml")
        {
            var xmlInputData = File.ReadAllText(path);

            return(XmlSerialiser.Deserialize <DefaultData>(xmlInputData));
        }
        public static CommonData SerialiseCommonData(string path = "Data/TestData/CommonData.xml")
        {
            var xmlInputData = File.ReadAllText(path);

            return(XmlSerialiser.Deserialize <CommonData>(xmlInputData));
        }