summaryrefslogtreecommitdiffstats
blob: f165f1c684f9f9f7010a583b4118e47d2508d976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (c) 2010 Remko Tronçon
 * Licensed under the GNU General Public License v3.
 * See Documentation/Licenses/GPLv3.txt for more information.
 */

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>

#include "Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h"

using namespace Swift;

class StatusShowSerializerTest : public CppUnit::TestFixture
{
		CPPUNIT_TEST_SUITE(StatusShowSerializerTest);
		CPPUNIT_TEST(testSerialize_Online);
		CPPUNIT_TEST(testSerialize_Away);
		CPPUNIT_TEST(testSerialize_FFC);
		CPPUNIT_TEST(testSerialize_XA);
		CPPUNIT_TEST(testSerialize_DND);
		CPPUNIT_TEST_SUITE_END();

	public:
		StatusShowSerializerTest() {}

		void testSerialize_Online() {
			StatusShowSerializer testling;
			boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Online));
			CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow));
		}

		void testSerialize_Away() {
			StatusShowSerializer testling;
			boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::Away));
			CPPUNIT_ASSERT_EQUAL(String("<show>away</show>"), testling.serialize(statusShow));
		}

		void testSerialize_FFC() {
			StatusShowSerializer testling;
			boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::FFC));
			CPPUNIT_ASSERT_EQUAL(String("<show>chat</show>"), testling.serialize(statusShow));
		}

		void testSerialize_XA() {
			StatusShowSerializer testling;
			boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::XA));
			CPPUNIT_ASSERT_EQUAL(String("<show>xa</show>"), testling.serialize(statusShow));
		}

		void testSerialize_DND() {
			StatusShowSerializer testling;
			boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::DND));
			CPPUNIT_ASSERT_EQUAL(String("<show>dnd</show>"), testling.serialize(statusShow));
		}

		void testSerialize_None() {
			StatusShowSerializer testling;
			boost::shared_ptr<StatusShow> statusShow(new StatusShow(StatusShow::None));
			CPPUNIT_ASSERT_EQUAL(String(""), testling.serialize(statusShow));
		}
};

CPPUNIT_TEST_SUITE_REGISTRATION(StatusShowSerializerTest);