public void SetUp() { theConverter = new ComplexTypeConverter(new ObjectConverter()); theSerializer = new NewtonSoftJsonSerializer(new JsonSerializerSettings(), new JsonConverter[] { theConverter }); theTarget = new ParentType { Name = "Test", Child = new ComplexType { Key = "x", Value = "123" } }; theResult = theSerializer.Serialize(theTarget, true); }
protected override void beforeEach() { theOutput = new ParentType { Name = "Josh", Child = new ComplexType { Key = "Test", Value = "Value" } }; Services.PartialMockTheClassUnderTest(); ClassUnderTest.Expect(x => x.Write(theOutput, MimeType.Json.ToString())); ClassUnderTest.Write(theOutput); }
protected override void beforeEach() { theJson = "{something}"; Services.PartialMockTheClassUnderTest(); ClassUnderTest.Stub(x => x.GetInputText()).Return(theJson); theTarget = new ParentType { Name = "Blah", Child = new ComplexType { Value = "123", Key = "x" } }; MockFor <IJsonSerializer>().Expect(x => x.Deserialize <ParentType>(theJson)).Return(theTarget); }
protected override void beforeEach() { theOutput = new ParentType { Name = "Josh", Child = new ComplexType { Key = "Test", Value = "Value" } }; theJson = "Hello"; theOutputWriter = new InMemoryOutputWriter(); Services.Inject <IOutputWriter>(theOutputWriter); MockFor <IJsonSerializer>().Stub(x => x.Serialize(theOutput)).Return(theJson); ClassUnderTest.Write(theOutput, MimeType.Json.ToString()); }