NUnit.Framework.Assert.AreSame(object, object)

Here are the examples of the csharp api class NUnit.Framework.Assert.AreSame(object, object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test] public void ExpectAndReturnWithArgument() 
		{
			object something = new object();
			mock.ExpectAndReturn("myMethod", something, "hello" );
			object result = mock.Call("myMethod", "hello");
			mock.Verify();
			Assert.AreSame(something, result);
		}

2. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test,ExpectedException(typeof(AssertionException))]
		public void SameFails()
		{
			Exception ex1 = new Exception( "one" );
			Exception ex2 = new Exception( "two" );
			expectedMessage =
				"  Expected: same as <System.Exception: one>" + Environment.NewLine +
				"  But was:  <System.Exception: two>" + Environment.NewLine;
			Assert.AreSame(ex1, ex2);
		}

3. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test] public void ExpectAndReturnWithArgument() 
		{
			object something = new object();
			mock.ExpectAndReturn("myMethod", something, "hello" );
			object result = mock.Call("myMethod", "hello");
			mock.Verify();
			Assert.AreSame(something, result);
		}

4. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test] public void ExpectAndReturnWithArgument() 
		{
			object something = new object();
			mock.ExpectAndReturn("myMethod", something, "hello" );
			object result = mock.Call("myMethod", "hello");
			mock.Verify();
			Assert.AreSame(something, result);
		}

5. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test,ExpectedException(typeof(AssertionException))]
		public void SameValueTypes()
		{
			int index = 2;
			expectedMessage =
				"  Expected: same as 2" + Environment.NewLine +
				"  But was:  2" + Environment.NewLine;
			Assert.AreSame(index, index);
		}

6. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test] public void ExpectAndReturn() 
		{
			object something = new object();
			mock.ExpectAndReturn("myMethod", something);
			object result = mock.Call("myMethod");
			mock.Verify();
			Assert.AreSame(something, result);
		}

7. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test,ExpectedException(typeof(AssertionException))]
		public void SameFails()
		{
			Exception ex1 = new Exception( "one" );
			Exception ex2 = new Exception( "two" );
			expectedMessage =
				"  Expected: same as <System.Exception: one>" + Environment.NewLine +
				"  But was:  <System.Exception: two>" + Environment.NewLine;
			Assert.AreSame(ex1, ex2);
		}

8. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test, ExpectedException(typeof(AssertionException))]
		public void ExpectAndReturnWithWrongArgument() 
		{
			object something = new object();
			mock.ExpectAndReturn( "myMethod", something, "hello" );
			object result = mock.Call("myMethod", "bye");
			mock.Verify();
			Assert.AreSame(something, result);
		}

9. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test] public void ExpectAndReturn() 
		{
			object something = new object();
			mock.ExpectAndReturn("myMethod", something);
			object result = mock.Call("myMethod");
			mock.Verify();
			Assert.AreSame(something, result);
		}

10. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test,ExpectedException(typeof(AssertionException))]
		public void SameValueTypes()
		{
			int index = 2;
			expectedMessage =
				"  Expected: same as 2" + Environment.NewLine +
				"  But was:  2" + Environment.NewLine;
			Assert.AreSame(index, index);
		}

11. Example

Project: ContinuousTests
Source File: DIContainerTests.cs
View license
[Test]
        public void Configuration_should_be_singleton()
        {
            var config1 = _locator.Locate<IConfiguration>();
            var config2 = _locator.Locate<IConfiguration>();
            Assert.AreSame(config1, config2);
        }

12. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test] public void ExpectAndReturn() 
		{
			object something = new object();
			mock.ExpectAndReturn("myMethod", something);
			object result = mock.Call("myMethod");
			mock.Verify();
			Assert.AreSame(something, result);
		}

13. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test,ExpectedException(typeof(AssertionException))]
		public void SameValueTypes()
		{
			int index = 2;
			expectedMessage =
				"  Expected: same as 2" + Environment.NewLine +
				"  But was:  2" + Environment.NewLine;
			Assert.AreSame(index, index);
		}

14. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test]
		public void Same()
		{
			string s1 = "S1";
			Assert.AreSame(s1, s1);
		}

15. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test, ExpectedException(typeof(AssertionException))]
		public void ExpectAndReturnWithWrongArgument() 
		{
			object something = new object();
			mock.ExpectAndReturn( "myMethod", something, "hello" );
			object result = mock.Call("myMethod", "bye");
			mock.Verify();
			Assert.AreSame(something, result);
		}

16. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test]
		public void Same()
		{
			string s1 = "S1";
			Assert.AreSame(s1, s1);
		}

17. Example

Project: ContinuousTests
Source File: MockTests.cs
View license
[Test, ExpectedException(typeof(AssertionException))]
		public void ExpectAndReturnWithWrongArgument() 
		{
			object something = new object();
			mock.ExpectAndReturn( "myMethod", something, "hello" );
			object result = mock.Call("myMethod", "bye");
			mock.Verify();
			Assert.AreSame(something, result);
		}

18. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test]
		public void Same()
		{
			string s1 = "S1";
			Assert.AreSame(s1, s1);
		}

19. Example

View license
public static void ShouldBeTheSameAs<T>(this T actual, T expected)
        {
            Assert.AreSame(expected, actual);
        }

20. Example

Project: ContinuousTests
Source File: SameFixture.cs
View license
[Test,ExpectedException(typeof(AssertionException))]
		public void SameFails()
		{
			Exception ex1 = new Exception( "one" );
			Exception ex2 = new Exception( "two" );
			expectedMessage =
				"  Expected: same as <System.Exception: one>" + Environment.NewLine +
				"  But was:  <System.Exception: two>" + Environment.NewLine;
			Assert.AreSame(ex1, ex2);
		}

21. Example

View license
[Test]
            public void Should_update_with_the_same_projection()
            {
                Assert.AreSame(_targetProjection, _targetProvider.UpdateProjection);
            }

22. Example

View license
[Test]
            public void Should_read_from_store()
            {
                Assert.AreSame(_targetProjection, _targetProvider.ReadProjection);
            }

23. Example

View license
[Test]
        public void When_OpenBucket_Is_Called_Multiple_Times_Same_Bucket_Object_IsReturned()
        {
            ClusterHelper.Initialize(TestConfiguration.GetCurrentConfiguration());
            var cluster = ClusterHelper.Get();
            cluster.SetupEnhancedAuth();

            var bucket1 = cluster.OpenBucket("default");
            var bucket2 = cluster.OpenBucket("default");

            Assert.AreSame(bucket1, bucket2);
        }

24. Example

View license
[Test]
        public void When_OpenBucket_Is_Called_Multiple_Times_Same_Bucket_Object_IsReturned()
        {
            ClusterHelper.Initialize(ClientConfigUtil.GetConfiguration());
            _cluster = ClusterHelper.Get();

            var bucket1 = _cluster.OpenBucket("default");
            var bucket2 = _cluster.OpenBucket("default");

            Assert.AreSame(bucket1, bucket2);
        }

25. Example

View license
[Test]
        public void TextureAtlas_EnumerateRegions_Test()
        {
            var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
            var atlas = new TextureAtlas(null, texture);

            var regions = new TextureRegion2D[3];
            regions[0] = atlas.CreateRegion("region0", 10, 20, 30, 40);
            regions[1] = atlas.CreateRegion("region1", 50, 60, 35, 45);
            regions[2] = atlas.CreateRegion("region2", 32, 33, 34, 35);
            var index = 0;

            foreach (var region in atlas)
            {
                Assert.AreSame(region, regions[index]);
                index++;
            }
        }

26. Example

View license
[Test]
        public void TextureAtlas_GetRegionsByName_Test()
        {
            var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
            var atlas = new TextureAtlas(null, texture);

            var region0 = atlas.CreateRegion("region0", 10, 20, 30, 40);
            var region1 = atlas.CreateRegion("region1", 50, 60, 35, 45);

            Assert.AreSame(region0, atlas["region0"]);
            Assert.AreSame(region1, atlas["region1"]);
            Assert.AreSame(region0, atlas.GetRegion("region0"));
            Assert.AreSame(region1, atlas.GetRegion("region1"));
        }

27. Example

View license
[Test]
        public void TextureAtlas_GetRegionsByIndex_Test()
        {
            var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
            var atlas = new TextureAtlas(null, texture);

            var region0 = atlas.CreateRegion("region0", 10, 20, 30, 40);
            var region1 = atlas.CreateRegion("region1", 50, 60, 35, 45);

            Assert.AreSame(region0, atlas[0]);
            Assert.AreSame(region1, atlas[1]);
            Assert.AreSame(region0, atlas.GetRegion(0));
            Assert.AreSame(region1, atlas.GetRegion(1));
        }

28. Example

Project: kafka-sharp
Source File: TestNode.cs.cs
View license
[Test]
        public void TestMetadataDecodeError()
        {
            var node = new Node("Pepitomustogussimo", () => new EchoConnectionMock(),
                                new Node.Serialization(null, Compatibility.V0_8_2, Pool, new byte[0], RequiredAcks.Leader, 1, CompressionCodec.None, 0, 100),
                                new Configuration());
            Exception ex = null;
            node.DecodeError += (n, e) =>
                {
                    Assert.AreSame(node, n);
                    ex = e;
                };

            var thrown = Assert.ThrowsAsync<Exception>(async () => await node.FetchMetadata());
            Assert.AreSame(thrown, ex);
        }

29. Example

Project: ActionMailerNext
Source File: MailerBaseTests.cs
View license
[Test]
        public void ModelObjectShouldCopyToEmailResult()
        {
            var mailer = new TestMailerBase();
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new TextViewEngine());
            mailer.HttpContextBase = MvcHelper.GetHttpContext("/app/", null, null);
            mailer.MailAttributes.From = new MailAddress("[email protected]");

            object model = "12345";
            EmailResult result = mailer.Email("TestView", model);

            Assert.AreSame(model, result.ViewData.Model);
        }

30. Example

Project: ActionMailerNext
Source File: MailerBaseTests.cs
View license
[Test]
        public void ModelObjectShouldCopyToEmailResult()
        {
            var mailer = new TestMailerBase();
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new TextViewEngine());
            mailer.HttpContextBase = MvcHelper.GetHttpContext("/app/", null, null);
            mailer.MailAttributes.From = new MailAddress("[email protected]");

            object model = "12345";
            EmailResult result = mailer.Email("TestView", model);

            Assert.AreSame(model, result.ViewData.Model);
        }

31. Example

Project: ActionMailerNext
Source File: MailerBaseTests.cs
View license
[Test]
        public void ModelObjectShouldCopyToEmailResult()
        {
            var mailer = new TestMailerBase();
            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new TextViewEngine());
            mailer.HttpContextBase = MvcHelper.GetHttpContext("/app/", null, null);
            mailer.MailAttributes.From = new MailAddress("[email protected]");

            object model = "12345";
            EmailResult result = mailer.Email("TestView", model);

            Assert.AreSame(model, result.ViewData.Model);
        }

32. Example

Project: ImTools
Source File: ImHashMapTests.cs
View license
[Test]
        public void Update_of_not_found_key_should_return_the_same_tree()
        {
            var tree = ImHashMap<int, string>.Empty
                .AddOrUpdate(1, "a").AddOrUpdate(2, "b").AddOrUpdate(3, "c").AddOrUpdate(4, "d");

            var updatedTree = tree.Update(5, "e");

            Assert.AreSame(tree, updatedTree);
        }

33. Example

View license
[Test]
        public void WindowProxyTest() {
            Window w = new Window();
            var ws1 = WindowProxy.GetWindowSurrogate(w);
            var ws2 = WindowProxy.GetWindowSurrogate(w);
            Assert.AreSame(ws1, ws2);
        }

34. Example

Project: OrigoDB
Source File: EngineConfigurationTest.cs
View license
[Test]
        public void InjectedSynchronizerIsResolved()
        {
            var config = new EngineConfiguration();
            var expected = new NullSynchronizer();
            config.SetSynchronizerFactory((c) => expected);
            var actual = config.CreateSynchronizer();
            Assert.AreSame(expected,actual);
        }

35. Example

Project: OrigoDB
Source File: EngineClientTest.cs
View license
[Test]
        public void LocalEngineClientReusesEngineReferences()
        {
            var config = CreateConfig();
            var localConfig1 = new LocalClientConfiguration(config);
            var localConfig2 = new LocalClientConfiguration(config);
            var client1 = (LocalEngineClient<TestModel>)localConfig1.GetClient<TestModel>();
            var client2 = (LocalEngineClient<TestModel>)localConfig2.GetClient<TestModel>();
            Assert.AreSame(client1.Engine, client2.Engine);
        }

36. Example

Project: OrigoDB
Source File: MethodMapTests.cs
View license
[Test]
        public void Maps_are_cached()
        {
            var map = MethodMap.MapFor<TestModel>();
            Assert.AreSame(_map, map);
        }

37. Example

Project: OrigoDB
Source File: EngineConfigurationTest.cs
View license
[Test]
        public void InjectedAuthorizerIsResolved()
        {
            var config = new EngineConfiguration();
            var expected = new Authorizer();
            config.SetAuthorizerFactory((c) => expected);
            var actual = config.CreateAuthorizer();
            Assert.AreSame(expected,actual);
        }

38. Example

Project: OrigoDB
Source File: EngineConfigurationTest.cs
View license
[Test]
        public void InjectedFormatterIsResolved()
        {
            var config = new EngineConfiguration();
            config.PacketOptions = null;
            var expected = new BinaryFormatter();
            config.SetFormatterFactory((c,f) => expected);
            var actual = config.CreateFormatter(FormatterUsage.Default);
            Assert.AreSame(expected, actual);
        }

39. Example

View license
[Test]
        public void GetModuleRequestResult_Returns_ModuleRequestResult_If_Present()
        {
            //Arrange
            var httpContext = MockHelper.CreateMockHttpContext();
            var expectedResult = new ModuleRequestResult();
            httpContext.Items[HttpContextExtensions.ModuleRequestResultKey] = expectedResult;

            //Act
            var result = httpContext.GetModuleRequestResult();

            //Assert
            Assert.AreSame(expectedResult, result);
        }

40. Example

View license
[Test]
        public void PetaPocoRepository_Constructor_Registers_Mapper()
        {
            //Arrange
            var mockMapper = new Mock<IMapper>();
            var db = new Database(connectionStringName);

            //Act
#pragma warning disable 168
            var repo = new PetaPocoRepository<Dog>(db, mockMapper.Object);
#pragma warning restore 168

            //Assert
            Assert.AreSame(mockMapper.Object, Mappers.GetMapper(typeof(Dog)));
        }

41. Example

Project: NPOI
Source File: TestDrawingShapes.cs
View license
[Test]
        public void TestOpt() {
            HSSFWorkbook wb = new HSSFWorkbook();

            // create a sheet with a text box
            HSSFSheet sheet = wb.CreateSheet() as HSSFSheet;
            HSSFPatriarch patriarch = sheet.CreateDrawingPatriarch() as HSSFPatriarch;

            HSSFTextbox textbox = patriarch.CreateTextbox(new HSSFClientAnchor()) as HSSFTextbox;
            EscherOptRecord opt1 = HSSFTestHelper.GetOptRecord(textbox);
            EscherOptRecord opt2 = HSSFTestHelper.GetEscherContainer(textbox).GetChildById(EscherOptRecord.RECORD_ID) as EscherOptRecord;
            Assert.AreSame(opt1, opt2);
        }

42. Example

Project: NPOI
Source File: BaseTestWorkbook.cs
View license
[Test]
        public void TestParentReferences()
        {
            IWorkbook workbook = _testDataProvider.CreateWorkbook();
            ISheet sheet = workbook.CreateSheet();
            Assert.AreSame(workbook, sheet.Workbook);

            IRow row = sheet.CreateRow(0);
            Assert.AreSame(sheet, row.Sheet);

            ICell cell = row.CreateCell(1);
            Assert.AreSame(sheet, cell.Sheet);
            Assert.AreSame(row, cell.Row);

            workbook = _testDataProvider.WriteOutAndReadBack(workbook);
            sheet = workbook.GetSheetAt(0);
            Assert.AreSame(workbook, sheet.Workbook);

            row = sheet.GetRow(0);
            Assert.AreSame(sheet, row.Sheet);

            cell = row.GetCell(1);
            Assert.AreSame(sheet, cell.Sheet);
            Assert.AreSame(row, cell.Row);
        }

43. Example

Project: NPOI
Source File: TestHSSFSheet.cs
View license
[Test]
        public void TestCreateDrawings()
        {
            IWorkbook workbook = new HSSFWorkbook();
            ISheet sheet = workbook.CreateSheet();
            HSSFPatriarch p1 = (HSSFPatriarch)sheet.CreateDrawingPatriarch();
            HSSFPatriarch p2 = (HSSFPatriarch)sheet.CreateDrawingPatriarch();
            Assert.AreSame(p1, p2);
        }

44. Example

View license
public static void ShouldBeTheSameAs(this object actual, object expected)
        {
            Assert.AreSame(expected, actual);
        }

45. Example

View license
public static void ShouldBeTheSameAs(this object actual, object expected)
        {
            Assert.AreSame(expected, actual);
        }

46. Example

View license
[Test]
		public void Ctor()
		{
			var c = new MockClientConnection (new MockConnectionProvider (MockProtocol.Instance));

			var protocols = new Dictionary<byte, Protocol> {
				{ MockProtocol.Instance.id, MockProtocol.Instance }
			};

			var context = new SerializationContext (c, protocols);
			Assert.AreSame (c, context.Connection);
			Assert.AreSame (MockProtocol.Instance, context.Protocols.First().Value);
		}

47. Example

View license
[Test]
		public void Resize_Capacity_SameBuffer()
		{
			byte[] array = new byte[6];
			var buffer = new WindowsRuntimeBuffer (array, 0, 1, 5);

			Assert.AreSame (array, buffer.Buffer);
		}

48. Example

View license
[Test]
		public void Resize_Length_SameBuffer()
		{
			byte[] array = new byte[6];
			var buffer = new WindowsRuntimeBuffer (array, 0, 1);

			Assert.AreSame (array, buffer.Buffer);
		}

49. Example

Project: nesper
Source File: TestLeftOuterJoinWhere.cs
View license
private void CompareEvent(EventBean receivedEvent, SupportBean_S0 expectedS0, SupportBean_S1 expectedS1) {
            Assert.AreSame(expectedS0, receivedEvent.Get("s0"));
            Assert.AreSame(expectedS1, receivedEvent.Get("s1"));
        }

50. Example

Project: nesper
Source File: TestEventInfraEventSender.cs
View license
private void RunAssertionSuccess(string typename, params object[] correctUnderlyings) {
	        var stmtText = "select * from " + typename;
	        var stmt = _epService.EPAdministrator.CreateEPL(stmtText);
	        var listener = new SupportUpdateListener();
	        stmt.AddListener(listener);

	        var sender = _epService.EPRuntime.GetEventSender(typename);
	        foreach (var underlying in correctUnderlyings) {
	            sender.SendEvent(underlying);
	            Assert.AreSame(underlying, listener.AssertOneGetNewAndReset().Underlying);
	        }

	        stmt.Dispose();
	    }