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 StandardFormatter_WhenCustomerHaveMultipleRentals_ShouldPass() { var customer = CustomerFactory.GetCustomer(); var standardFormatter = new StandardFormatter(); var serializedData = customer.GetStatement(standardFormatter); Customer actual = standardFormatter.Deserialize(serializedData); Assert.True(customer.Equals(actual)); }