Esempio n. 1
0
        public void ICanSerializeAndDeserializeAHttpUserChangeRequest()
        {
            string username = "******";
            string password = GetRandomValidPassword();
            var    payload  = PayloadConverter.SerializeHttpConnectivityRequest(UserChangeRequestOperationType.Enable, username, password, DateTimeOffset.MinValue);

            var serverConverter = new ClusterProvisioningServerPayloadConverter();
            var request         = serverConverter.DeserializeChangeRequest <HttpUserChangeRequest>(payload);

            Assert.AreEqual(username, request.Username, "Round trip serialize/deserialize enable http does not match username");
            Assert.AreEqual(password, request.Password, "Round trip serialize/deserialize enable http does not match password");
            Assert.AreEqual(UserChangeOperationType.Enable, request.Operation, "Round trip serialize/deserialize enable http does not match operation requested");

            payload = PayloadConverter.SerializeHttpConnectivityRequest(UserChangeRequestOperationType.Disable, username, password, DateTimeOffset.MinValue);

            request = serverConverter.DeserializeChangeRequest <HttpUserChangeRequest>(payload);

            Assert.AreEqual(UserChangeOperationType.Disable, request.Operation, "Round trip serialize/deserialize disabl http does not match operation requested");
            // Technically per spec these shouldn't matter for disable... but the serializer should do it's jobDetails correctly.
            Assert.AreEqual(username, request.Username, "Round trip serialize/deserialize disable http does not match username");
            Assert.AreEqual(password, request.Password, "Round trip serialize/deserialize disable http does not match password");
        }