public void Can_Parse_GasLog_String_Content(string contentText) { // Arrange var xmlDoc = XDocument.Parse(string.Format(NoteXmlTextBase, XmlNamespace, contentText)); CurrentTime = new DateTime(2021, 10, 15); var gasLog = new GasLog { Date = new DateTime(2021, 8, 15), Car = _defaultCar, Distance = 300d.GetKilometer(), CurrentMeterReading = 13000d.GetKilometer(), Gas = 34d.GetLiter(), Price = 1.34m.GetCad(), Station = "Costco", Discounts = new List <GasDiscountInfo>(), Comment = string.Empty, CreateDate = DateProvider.UtcNow }; // Act var note = _noteSerializer.GetNote(gasLog); // Assert Assert.True(_noteSerializer.ProcessResult.Success); Assert.NotNull(note); Assert.Equal(AutomobileConstant.GasLogRecordSubject, note.Subject); Assert.Equal(note.Content, xmlDoc.ToString(SaveOptions.DisableFormatting)); }
public void Can_Parse_Automobile_String_Content(string contentText) { // Arrange var xmlDoc = XDocument.Parse(string.Format(NoteXmlTextBase, XmlNamespace, contentText)); var auto = new AutomobileInfo { Maker = "Subaru", Brand = "Outback", Year = "2017", Color = "Blue", Pin = "135", Plate = "BCTT208", MeterReading = 1234535 }; // Act var note = _noteSerializer.GetNote(auto); // Assert Assert.True(_noteSerializer.ProcessResult.Success); Assert.NotNull(note); Assert.Equal(AutomobileConstant.AutoMobileRecordSubject, note.Subject); Assert.Equal(note.Content, xmlDoc.ToString(SaveOptions.DisableFormatting)); }
public static HmmNote GetNote(this GasDiscount discount, INoteSerializer <GasDiscount> serializer, Author author) { Guard.Against <ArgumentNullException>(author == null, nameof(author)); if (discount == null) { return(null); } var note = serializer.GetNote(discount); note.Author = author; return(note); }
public static HmmNote GetNote(this AutomobileInfo automobile, INoteSerializer <AutomobileInfo> serializer, Author author) { Guard.Against <ArgumentNullException>(author == null, nameof(author)); if (automobile == null) { return(null); } var note = serializer.GetNote(automobile); note.Author = author; return(note); }
public void Can_Parse_Discount_String_Content(string contentText) { // Arrange var xmlDoc = XDocument.Parse(string.Format(NoteXmlTextBase, XmlNamespace, contentText)); var discount = new GasDiscount { Program = "Petro-Canada membership", Amount = 0.8m.GetCad(), DiscountType = GasDiscountType.PerLiter, IsActive = true }; // Act var note = _noteSerializer.GetNote(discount); // Assert Assert.True(_noteSerializer.ProcessResult.Success); Assert.NotNull(note); Assert.Equal(AutomobileConstant.GasDiscountRecordSubject, note.Subject); Assert.Equal(note.Content, xmlDoc.ToString(SaveOptions.DisableFormatting)); }
public static HmmNote GetNote(this GasLog log, INoteSerializer <GasLog> serializer, Author author) { Guard.Against <ArgumentNullException>(author == null, nameof(author)); if (log == null) { return(null); } var note = serializer.GetNote(log); note.Subject = GasLog.GetNoteSubject(log.Car.Id); note.Author = author; return(note); }