public void CompositeFormatter_WhenCustomerHaveMultipleRentals_ShouldPass() { var jsonFormatter = new JsonFormatter(); var xmlFormatter = new XmlFormatter(); var standardFormatter = new StandardFormatter(); var compositeFormatter = new CompositeFormatter(); compositeFormatter.AddFormatter(new JsonFormatter()); compositeFormatter.AddFormatter(new StandardFormatter()); compositeFormatter.AddFormatter(new XmlFormatter()); var customer = CustomerFactory.GetCustomer(); var serializedData = customer.GetStatement(compositeFormatter); Customer actualFromJson = jsonFormatter.Deserialize(serializedData); Customer actualFromXml = xmlFormatter.Deserialize(serializedData); Customer actualFromStandard = standardFormatter.Deserialize(serializedData); Assert.True(customer.Equals(actualFromJson)); Assert.True(customer.Equals(actualFromXml)); Assert.True(customer.Equals(actualFromStandard)); }
public void XmlFormatter_WhenCustomerHaveMultipleRentals_ShouldPass() { var customer = CustomerFactory.GetCustomer(); var xmlFormatter = new XmlFormatter(); var serializedData = customer.GetStatement(xmlFormatter); Customer actual = xmlFormatter.Deserialize(serializedData); Assert.True(customer.Equals(actual)); }