public void AcceptanceTest() { string inputPath = Path.Combine(AppContext.BaseDirectory, "Input1.json"); ITapDeserializer tapDeserializer = new JsonTapDeserializer(); Mock <IJourneySerializer> mock = new(); IJourneySerializer customerSerializer = mock.Object; ITravelControler travelControlerControler = new TravelControler(new Travel(Factory.Zones()), tapDeserializer, customerSerializer, Mock.Of <IPrinter>()); travelControlerControler.Price(inputPath, String.Empty); mock.Setup(x => x.Serialize(It.Is <Journeys>(cs => Equal(cs, CustomerSummaries())))); }
public void AcceptanceWithGivenFiles() { string inputPath = Path.Combine(AppContext.BaseDirectory, "Input2.json"); string testOutput = File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "Output2.json")); ITapDeserializer tapDeserializer = new JsonTapDeserializer(); IJourneySerializer customerSerializer = new JsonJourneySerializer(); Mock <IPrinter> mock = new(); ITravelControler travelControlerControler = new TravelControler(new Travel(Factory.Zones()), tapDeserializer, customerSerializer, mock.Object); travelControlerControler.Price(inputPath, string.Empty); mock.Verify(x => x.Print(It.Is <string>(x => EqualJson(x, testOutput)), It.IsAny <string>())); }
public void SerializeOneTap() { Mock <ITravel> mockTravel = new(); ITapDeserializer tapDeserializer = new JsonTapDeserializer(); ITravelControler travelControler = new TravelControler(mockTravel.Object, tapDeserializer, Mock.Of <IJourneySerializer>(), Mock.Of <IPrinter>()); string inputPath = Path.Combine(AppContext.BaseDirectory, "InputTap.json"); travelControler.Price(inputPath, string.Empty); mockTravel.Verify(x => x.Compute(new List <Tap> { new() { UnixTimeStamp = 1572242400, CustomerId = 1, Station = @"A" } }));