﻿using System;
using DCSExt.Xml.Tests.TestClasses;
using Machine.Specifications;

namespace DCSExt.Xml.Tests {
    [Subject(typeof(DataContractSerializerExt))]
    public class When_deserializing_testCaseTypeDeserialization_orderd : DeserializingContext<TestCaseTypeDeserialization> {
        private Establish context = () => mXmlTextReader = TestCaseTypeDeserialization.OrderedXml().ToXmlTextReader();

        private It Should_create_an_object = () => mResult.ShouldNotBeNull();
        private It Should_set_bool_to_true = () => mResult.Boolean.ShouldBeTrue();
        private It Should_set_byte_to_10 = () => {
            const byte expected = 10;
            mResult.Byte.ShouldEqual(expected);
        };
        private It Should_set_char_to_c = () => mResult.Char.ShouldEqual('c');
        private It Should_set_decimal_to_13Dot37 = () => mResult.Decimal.ShouldEqual(13.37m);
        private It Should_set_double_to_26Dot77 = () => mResult.Double.ShouldEqual(26.77);
        private It Should_set_int16_to_16 = () => mResult.Int16.ShouldEqual((Int16)16);
        private It Should_set_int32_to_32 = () => mResult.Int32.ShouldEqual(32);
        private It Should_set_int64_to_64 = () => mResult.Int64.ShouldEqual(64);
        private It Should_set_single_to_6Dot66 = () => mResult.Single.ShouldEqual(6.66f);
        private It Should_set_string_to_string = () => mResult.String.ShouldEqual("String");
        private It Should_set_guid_to_5a30e17a_0db4_4420_993a_00d1ea0799e6 = () => mResult.Guid.ShouldEqual(new Guid("5a30e17a-0db4-4420-993a-00d1ea0799e6"));
        private It Should_set_dateTime_to_20130101120000 = () => mResult.DateTime.ShouldEqual(new DateTime(2013, 1, 1, 12, 0, 0));
    }
}